Spaces:
Running
Running
Achille Thin - Genesis
commited on
Commit
·
944e40e
1
Parent(s):
af0c8b5
change temperature and prompt
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ 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)
|
31 |
embed_model = MistralAIEmbedding(model_name="mistral-embed", api_key=env_api_key, max_length=2000)
|
32 |
|
33 |
# create client and a new collection
|
@@ -47,18 +47,18 @@ loader = PDFReader()
|
|
47 |
index = VectorStoreIndex(
|
48 |
[], service_context=service_context, storage_context=storage_context
|
49 |
)
|
50 |
-
query_engine = index.as_query_engine(similarity_top_k=
|
51 |
|
52 |
def create_prompt(farmSize, cultures):
|
53 |
prompt = f"""
|
54 |
-
You are
|
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
|
61 |
-
Réponds en français en formulant un tableau avec les cultures que tu veux cultiver et par parcelle
|
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.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
|
|
|
47 |
index = VectorStoreIndex(
|
48 |
[], service_context=service_context, storage_context=storage_context
|
49 |
)
|
50 |
+
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 |
|