Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -81,28 +81,27 @@ class MathRetrievalQA(dspy.Program):
|
|
81 |
return {"answer": "", "retrieved_context": ""}
|
82 |
|
83 |
prompt = f"""
|
84 |
-
You are a math
|
85 |
|
86 |
-
|
87 |
-
- Use
|
88 |
-
-
|
89 |
-
-
|
90 |
-
-
|
91 |
-
-
|
92 |
-
|
93 |
-
---
|
94 |
|
95 |
Problem:
|
96 |
{question}
|
97 |
|
98 |
-
|
99 |
{context}
|
100 |
|
101 |
-
Write the solution in
|
102 |
"""
|
103 |
|
104 |
|
105 |
|
|
|
106 |
try:
|
107 |
model = genai.GenerativeModel('gemini-2.0-flash') # or use 'gemini-1.5-flash'
|
108 |
response = model.generate_content(prompt)
|
|
|
81 |
return {"answer": "", "retrieved_context": ""}
|
82 |
|
83 |
prompt = f"""
|
84 |
+
You are a math textbook author. Write a clear, professional, and well-formatted solution for the following math problem, using proper LaTeX formatting in every step.
|
85 |
|
86 |
+
Instructions:
|
87 |
+
- Use step-by-step headings: "Step 1", "Step 2", etc.
|
88 |
+
- Format all mathematical expressions in LaTeX (inside $$ for block or \\( ... \\) for inline).
|
89 |
+
- Avoid repeating the same math in plain text (e.g., don't write both "2t = y + 1" and "2t=y+1").
|
90 |
+
- Use aligned LaTeX equations for clarity where necessary.
|
91 |
+
- End with the final boxed answer in LaTeX like: \\boxed{{...}}
|
|
|
|
|
92 |
|
93 |
Problem:
|
94 |
{question}
|
95 |
|
96 |
+
Use the following context if needed:
|
97 |
{context}
|
98 |
|
99 |
+
Write only the formatted solution, as it would appear in a math textbook.
|
100 |
"""
|
101 |
|
102 |
|
103 |
|
104 |
+
|
105 |
try:
|
106 |
model = genai.GenerativeModel('gemini-2.0-flash') # or use 'gemini-1.5-flash'
|
107 |
response = model.generate_content(prompt)
|