MariaFilipkowska commited on
Commit
67f4669
·
verified ·
1 Parent(s): 985ae82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -208,24 +208,23 @@ class BasicAgent:
208
  wrong_answers = ["Requests rate limit exceeded", "", " ", " ", "insufficient information"]
209
  while not answer or answer in wrong_answers or answer.lower().startswith("error"):
210
  try:
211
- alfred = build_agent(chat3)
212
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
213
  except Exception as e:
214
  print(e)
215
- alfred = build_agent(chat1)
216
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
217
  if answer:
218
- alfred_super = build_agent(chat1)
219
  answer_fin = alfred_super.invoke(
220
  input={"messages": [
221
  SystemMessage(
222
- content="Verify the answer to the following question. If the answer is correct, return it.\
223
  If it's incorrect, return just the corrected answer. \
224
- Do not add any comments or characters, you should return just the final answer: \
225
- either a string, or a number, or a comma separated list."
226
  ),
227
  HumanMessage(
228
- content=f"{system_prompt}. QUESTION: {message.content}, ANSWER: {answer}"
229
  )
230
  ]},
231
  config={"recursion_limit": 6}
 
208
  wrong_answers = ["Requests rate limit exceeded", "", " ", " ", "insufficient information"]
209
  while not answer or answer in wrong_answers or answer.lower().startswith("error"):
210
  try:
211
+ alfred = build_agent(chat1)
212
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
213
  except Exception as e:
214
  print(e)
215
+ alfred = build_agent(chat3)
216
  answer = alfred.invoke(input={"messages": [system_prompt, message]},config={"recursion_limit": 6})['messages'][-1].content
217
  if answer:
218
+ alfred_super = build_agent(chat3)
219
  answer_fin = alfred_super.invoke(
220
  input={"messages": [
221
  SystemMessage(
222
+ content="Verify the answer to the following question. If the answer is correct, return the same answer unchanged.\
223
  If it's incorrect, return just the corrected answer. \
224
+ Do not add any comments or characters, you should return just the final answer."
 
225
  ),
226
  HumanMessage(
227
+ content=f"QUESTION: {message.content}, ANSWER: {answer}"
228
  )
229
  ]},
230
  config={"recursion_limit": 6}