Update agent.py
Browse files
agent.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
# agent.py — GAIA-ready with FunctionCallingAgent and
|
2 |
|
3 |
import os
|
4 |
import asyncio
|
@@ -110,15 +110,11 @@ Rules:
|
|
110 |
"""
|
111 |
)
|
112 |
|
113 |
-
|
|
|
114 |
try:
|
115 |
-
resp = agent.
|
116 |
-
if hasattr(resp, "response")
|
117 |
-
return resp.response.content.strip()
|
118 |
-
return str(resp).strip()
|
119 |
except Exception as e:
|
120 |
print("❌ Agent exception:", e)
|
121 |
-
return "[ERROR] " + str(e)
|
122 |
-
|
123 |
-
async def answer_question(question: str) -> str:
|
124 |
-
return answer_question_sync(question)
|
|
|
1 |
+
# agent.py — GAIA-ready async agent with FunctionCallingAgent and tool_call fix
|
2 |
|
3 |
import os
|
4 |
import asyncio
|
|
|
110 |
"""
|
111 |
)
|
112 |
|
113 |
+
# Async-only interface to avoid tool_call sync error
|
114 |
+
async def answer_question(question: str) -> str:
|
115 |
try:
|
116 |
+
resp = await agent.achat(question)
|
117 |
+
return resp.response.content.strip() if hasattr(resp, "response") else str(resp).strip()
|
|
|
|
|
118 |
except Exception as e:
|
119 |
print("❌ Agent exception:", e)
|
120 |
+
return "[ERROR] " + str(e)
|
|
|
|
|
|