rairo commited on
Commit
2bc1d5b
·
verified ·
1 Parent(s): abd6c6c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +14 -5
main.py CHANGED
@@ -1943,14 +1943,23 @@ Return exactly one of the four category names above, with no extra words or punc
1943
 
1944
  # 5) Main answer prompt
1945
  main_prompt = f"""
1946
- You are Tunasonga Agri Assistant
1947
- User Query: "{user_message}"
1948
- The classified intent is: {intent}
1949
  {context_for_gemini}
1950
- Answer accordingly.
 
 
 
 
 
 
 
 
1951
  """
 
1952
  try:
1953
- response_obj_gemini = gemini_client.generate_content(
1954
  model='gemini-2.0-flash',
1955
  contents=[{'parts': [{'text': main_prompt}]}]
1956
  )
 
1943
 
1944
  # 5) Main answer prompt
1945
  main_prompt = f"""
1946
+ You are Tunasonga Agri Assistant, an AI for an agricultural marketplace in Zimbabwe and SADC.
1947
+ Your goal is to provide helpful, concise, and accurate information. Your persona is professional, friendly, and supportive of farmers and agri-businesses.
1948
+ The user's original query intent was classified as: {intent}
1949
  {context_for_gemini}
1950
+ Based on the user's query and any provided context above, please formulate your answer to the user.
1951
+ User Query: "{user_message}"
1952
+ Specific Instructions based on intent:
1953
+ - If the intent was 'platform_data_query': Use the "Current Platform Data Context" to answer. If the context says no items were found, relay that and suggest they browse the marketplace or refine their search. Do not invent listings.
1954
+ - If the intent was 'price_trend_query': Use the "Price Trend Analysis Context". If the context says trends couldn't be generated, relay that. Do not invent trends.
1955
+ - For 'general_agri_info': Use your broad agricultural knowledge. Focus on practices relevant to the SADC region, smallholder farmers, climate-smart agriculture, market access, and agri-business development. Provide actionable advice if possible.
1956
+ - If the query is unclear, classified as "other", or if the context is insufficient for a specific query: Provide a polite general response, ask for clarification, or gently guide the user on how you can help (e.g., "I can help with finding produce, getting price trends, or general farming advice. What would you like to know?").
1957
+ Keep your answers clear and easy to understand. Avoid overly technical jargon unless necessary and explain it.
1958
+ Answer:
1959
  """
1960
+
1961
  try:
1962
+ response_obj_gemini = gemini_client.models.generate_content(
1963
  model='gemini-2.0-flash',
1964
  contents=[{'parts': [{'text': main_prompt}]}]
1965
  )