Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,15 +80,27 @@ class MathRetrievalQA(dspy.Program):
|
|
| 80 |
if not context:
|
| 81 |
return {"answer": "", "retrieved_context": ""}
|
| 82 |
|
| 83 |
-
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
{context}
|
| 90 |
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
| 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'
|