Spaces:
Running
Running
Daniel Amendoeira
commited on
Update agent.py
Browse files
agent.py
CHANGED
@@ -114,16 +114,9 @@ class LangGraphAgent:
|
|
114 |
]
|
115 |
}
|
116 |
|
117 |
-
print(f"Running LangGraphAgent with input: {question[:
|
118 |
result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) # prevents infinite looping when the LLM keeps calling tools over and over
|
119 |
-
|
120 |
-
content_message = result["messages"][-1].content # extract content from the last message
|
121 |
-
texts = [
|
122 |
-
obj["text"]
|
123 |
-
for obj in content_message
|
124 |
-
if isinstance(obj, dict) and obj.get("type") == "text"
|
125 |
-
]
|
126 |
-
final_response = "\n".join(texts).strip() # join and clean
|
127 |
|
128 |
try:
|
129 |
return final_response.split("FINAL ANSWER:")[-1].strip() # parse out only what's after "FINAL ANSWER:"
|
|
|
114 |
]
|
115 |
}
|
116 |
|
117 |
+
print(f"Running LangGraphAgent with input: {question[:150]}...")
|
118 |
result = gaia_agent.invoke(input_state, {"recursion_limit": 30}) # prevents infinite looping when the LLM keeps calling tools over and over
|
119 |
+
final_response = result["messages"][-1].content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
try:
|
122 |
return final_response.split("FINAL ANSWER:")[-1].strip() # parse out only what's after "FINAL ANSWER:"
|