errchh
commited on
Commit
·
135697e
1
Parent(s):
5682fff
fix basic agent
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
-
from langchain_core.messages import HumanMessage
|
| 8 |
from agent import build_graph
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
|
@@ -29,7 +29,8 @@ class BasicAgent:
|
|
| 29 |
for msg in reversed(result["messages"]): # Look for the last AI message
|
| 30 |
# Check if the message is an AIMessage and has content
|
| 31 |
if isinstance(msg, AIMessage) and hasattr(msg, 'content') and msg.content:
|
| 32 |
-
|
|
|
|
| 33 |
break # Found the last AI message content
|
| 34 |
|
| 35 |
return submitted_answer
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
+
from langchain_core.messages import HumanMessage, AIMessage
|
| 8 |
from agent import build_graph
|
| 9 |
|
| 10 |
# (Keep Constants as is)
|
|
|
|
| 29 |
for msg in reversed(result["messages"]): # Look for the last AI message
|
| 30 |
# Check if the message is an AIMessage and has content
|
| 31 |
if isinstance(msg, AIMessage) and hasattr(msg, 'content') and msg.content:
|
| 32 |
+
# Convert content to string to ensure type consistency with return hint
|
| 33 |
+
submitted_answer = str(msg.content)
|
| 34 |
break # Found the last AI message content
|
| 35 |
|
| 36 |
return submitted_answer
|