dawid-lorek commited on
Commit
3b19200
·
verified ·
1 Parent(s): d092bd1

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +6 -10
agent.py CHANGED
@@ -1,4 +1,4 @@
1
- # agent.py — GAIA-ready with FunctionCallingAgent and improved tools
2
 
3
  import os
4
  import asyncio
@@ -110,15 +110,11 @@ Rules:
110
  """
111
  )
112
 
113
- def answer_question_sync(question: str) -> str:
 
114
  try:
115
- resp = agent.chat(question)
116
- if hasattr(resp, "response") and hasattr(resp.response, "content"):
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)