Achille Thin - Genesis commited on
Commit
1771168
·
1 Parent(s): bed8871

prompt editing

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -27,8 +27,8 @@ env_api_key = os.environ.get("MISTRAL_API_KEY")
27
  query_engine = None
28
 
29
  # Define LLMs
30
- llm = MistralAI(api_key=env_api_key, model=llm_model, temperature = 0.4)
31
- embed_model = MistralAIEmbedding(model_name="mistral-embed", api_key=env_api_key, max_length=2000)
32
 
33
  # create client and a new collection
34
  db = chromadb.PersistentClient(path="./chroma_db")
@@ -51,14 +51,14 @@ query_engine = index.as_query_engine(similarity_top_k=10)
51
 
52
  def create_prompt(farmSize, cultures):
53
  prompt = f"""
54
- You are a French agronomical advisor, answering in French. Your task is to provide an advice as a table of rotation crops (with a prioritary suggestion and an alternative one) to the farmer what to seed in the next year and in which proportion. You will be given the historical information about the farmer, and context data given previously gives you average performances in yield per acre by region and by culture, as well as production costs and selling prices. Consider agronomical limitation and provide advice to the farmer to maximize his profit (maximum yield and revenue -- the difference between the selling price and the cost of production).
55
  #facts
56
  The farm area is {farmSize} ha.
57
  """
58
  for i, culture in enumerate(cultures):
59
  prompt += f"Parcel {i+1} most recently grew {culture}."
60
- prompt += """I need you to answer in French formulating a table with the crops you want to grow and by parcel, and predicting revenue per acre according to the scenario asked for (mean, pessimistic or optimistic. Default: mean).
61
- Réponds en français en formulant un tableau avec les cultures que tu veux cultiver et par parcelle, et en prévoyant le revenu par hectare selon le scénario demandé (moyen, pessimiste ou optimiste. Par défaut : moyen).\n"
62
  """
63
  return prompt
64
 
 
27
  query_engine = None
28
 
29
  # Define LLMs
30
+ llm = MistralAI(api_key=env_api_key, model=llm_model, temperature = 0.2)
31
+ embed_model = MistralAIEmbedding(model_name="mistral-embed", api_key=env_api_key, max_length=5000)
32
 
33
  # create client and a new collection
34
  db = chromadb.PersistentClient(path="./chroma_db")
 
51
 
52
  def create_prompt(farmSize, cultures):
53
  prompt = f"""
54
+ You are a French agronomical advisor, answering in French. Your task is to provide an concise advice as a table of rotation crops (with a prioritary suggestion and an alternative one) to the farmer what to seed in the next year and in which proportion. You will be given the historical information about the farmer, and context data given previously gives you average performances in yield per acre by region and by culture, as well as production costs and selling prices. Consider agronomical limitation and provide advice to the farmer to maximize his profit (maximum yield and revenue -- the difference between the selling price and the cost of production). There are three possible scenarii, pessimistic (lowest revenue), optimistic (highest revenue) and mean.
55
  #facts
56
  The farm area is {farmSize} ha.
57
  """
58
  for i, culture in enumerate(cultures):
59
  prompt += f"Parcel {i+1} most recently grew {culture}."
60
+ prompt += """I need you to answer in French formulating a concise table with the crops you want to grow and by parcel, and predicting revenue per acre according to the scenario asked for (mean, pessimistic or optimistic. Default: mean).
61
+ Réponds en français en formulant un tableau concis avec les cultures que tu veux cultiver et par parcelle, et en prévoyant le revenu par hectare selon le scénario demandé (moyen, pessimiste ou optimiste. Par défaut : moyen).\n"
62
  """
63
  return prompt
64