Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,8 +22,11 @@ class BasicAgent:
|
|
| 22 |
question = [HumanMessage(content=question)]
|
| 23 |
final_answer = self.agent.invoke({"messages": question})
|
| 24 |
print(f"Agent returning fixed answer: {final_answer}")
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
| 27 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 28 |
"""
|
| 29 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
|
| 22 |
question = [HumanMessage(content=question)]
|
| 23 |
final_answer = self.agent.invoke({"messages": question})
|
| 24 |
print(f"Agent returning fixed answer: {final_answer}")
|
| 25 |
+
text = final_answer["messages"][-1].content
|
| 26 |
+
if "FINAL ANSWER: " in text:
|
| 27 |
+
return text.partition("FINAL ANSWER: ")[2].strip()
|
| 28 |
+
return text.strip()
|
| 29 |
+
|
| 30 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 31 |
"""
|
| 32 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|