Spaces:
Sleeping
Sleeping
debugging
Browse files
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 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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):
|