manasagangotri commited on
Commit
e25d497
·
verified ·
1 Parent(s): 4f1e7f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -91,6 +91,8 @@ class MathRetrievalQA(dspy.Program):
91
  context_items = retrieve_from_qdrant(question)
92
  context = "\n".join([item["solution"] for item in context_items if "solution" in item])
93
  print("Context for generation:", context)
 
 
94
 
95
  if not context:
96
  return {"answer": "", "retrieved_context": ""}
@@ -109,7 +111,7 @@ Problem:
109
  {question}
110
 
111
  Use the following context if needed:
112
- {context}
113
 
114
  Write only the formatted solution, as it would appear in a math textbook.
115
  """
@@ -121,7 +123,7 @@ Write only the formatted solution, as it would appear in a math textbook.
121
  model = genai.GenerativeModel('gemini-2.0-flash') # or use 'gemini-1.5-flash'
122
 
123
  response = model.generate_content(prompt)
124
- formatted_answer = latex_to_plain_math(response.text)
125
  print("Gemini Answer:", formatted_answer)
126
 
127
  return {"answer": formatted_answer, "retrieved_context": context}
 
91
  context_items = retrieve_from_qdrant(question)
92
  context = "\n".join([item["solution"] for item in context_items if "solution" in item])
93
  print("Context for generation:", context)
94
+ f = latex_to_plain_math(context)
95
+ print(f)
96
 
97
  if not context:
98
  return {"answer": "", "retrieved_context": ""}
 
111
  {question}
112
 
113
  Use the following context if needed:
114
+ {f}
115
 
116
  Write only the formatted solution, as it would appear in a math textbook.
117
  """
 
123
  model = genai.GenerativeModel('gemini-2.0-flash') # or use 'gemini-1.5-flash'
124
 
125
  response = model.generate_content(prompt)
126
+ formatted_answer = response.text
127
  print("Gemini Answer:", formatted_answer)
128
 
129
  return {"answer": formatted_answer, "retrieved_context": context}