manasagangotri commited on
Commit
0c6da03
·
verified ·
1 Parent(s): 1d3dd26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -80,15 +80,27 @@ class MathRetrievalQA(dspy.Program):
80
  if not context:
81
  return {"answer": "", "retrieved_context": ""}
82
 
83
- # Prompt Gemini to generate and format a math answer
84
- prompt = f"""You are a math expert. Given the question and context below, generate a step-by-step solution in a clear, neat, and well-formatted way.
85
 
86
- Question: {question}
 
 
 
 
87
 
88
- Context:
 
 
 
 
 
89
  {context}
90
 
91
- Answer:"""
 
 
 
92
 
93
  try:
94
  model = genai.GenerativeModel('gemini-2.0-flash') # or use 'gemini-1.5-flash'
 
80
  if not context:
81
  return {"answer": "", "retrieved_context": ""}
82
 
83
+ prompt = f"""
84
+ You are a math expert writing solutions in a textbook. Provide a detailed, step-by-step solution for the following math problem.
85
 
86
+ Follow these guidelines:
87
+ - Use clear headings like "Step 1", "Step 2", etc.
88
+ - Use proper mathematical notation with LaTeX.
89
+ - Make the explanation educational and logically structured.
90
+ - Format the final answer as: Final Answer: \\boxed{{...}}
91
 
92
+ ---
93
+
94
+ Problem:
95
+ {question}
96
+
97
+ Context (if needed for the solution):
98
  {context}
99
 
100
+ Write the solution in full below:
101
+ """
102
+
103
+
104
 
105
  try:
106
  model = genai.GenerativeModel('gemini-2.0-flash') # or use 'gemini-1.5-flash'