Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -268,13 +268,17 @@ class BasicAgent:
|
|
268 |
]
|
269 |
|
270 |
|
|
|
271 |
def __call__(self, question: str) -> str:
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
|
|
|
|
278 |
|
279 |
|
280 |
|
|
|
268 |
]
|
269 |
|
270 |
|
271 |
+
|
272 |
def __call__(self, question: str) -> str:
|
273 |
+
state = init_state(question)
|
274 |
+
final_state = self.workflow.invoke(state)
|
275 |
+
|
276 |
+
# Extract final answer
|
277 |
+
for msg in reversed(final_state['history']):
|
278 |
+
if isinstance(msg, AIMessage) and "FINAL ANSWER:" in msg.content:
|
279 |
+
return msg.content.split("FINAL ANSWER:")[1].strip()
|
280 |
+
|
281 |
+
return "No final answer found"
|
282 |
|
283 |
|
284 |
|