D3MI4N commited on
Commit
a755d37
·
1 Parent(s): 6321824

debugging

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -17,9 +17,17 @@ class GaiaAgent:
17
  def __call__(self, question: str) -> str:
18
  print("Received question:", question)
19
  state = {"question": question, "answer": ""}
20
- final_state = graph.invoke(state)
21
- answer = final_state.get("answer", "No answer generated.")
22
- return answer
 
 
 
 
 
 
 
 
23
 
24
  # Async runner
25
  async def run_agent(profile: gr.OAuthProfile | None):
 
17
  def __call__(self, question: str) -> str:
18
  print("Received question:", question)
19
  state = {"question": question, "answer": ""}
20
+ try:
21
+ result = graph.invoke(state)
22
+ print("Result type:", type(result))
23
+ print("Result value:", result)
24
+ if isinstance(result, dict):
25
+ return result.get("answer", "No answer generated.")
26
+ else:
27
+ return f"Unexpected output from graph: {result}"
28
+ except Exception as e:
29
+ return f"ERROR invoking graph: {e}"
30
+
31
 
32
  # Async runner
33
  async def run_agent(profile: gr.OAuthProfile | None):