Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,17 +73,19 @@ async def smart_agent(questions_data: List[Dict[str, Any]]) -> List[Dict[str, An
|
|
| 73 |
|
| 74 |
try:
|
| 75 |
# Retry up to 3 times if connection closes
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
| 87 |
except Exception as e:
|
| 88 |
print(f"Error on Task {task_id}: {e}")
|
| 89 |
return {"task_id": task_id, "submitted_answer": f"AGENT ERROR: {e}"}
|
|
|
|
| 73 |
|
| 74 |
try:
|
| 75 |
# Retry up to 3 times if connection closes
|
| 76 |
+
response = await llamaindex_agent.run(question_text)
|
| 77 |
+
print(f"Answered Task {task_id}: {response[:50]}...")
|
| 78 |
+
return {"task_id": task_id, "submitted_answer": response}
|
| 79 |
+
# for attempt in range(3):
|
| 80 |
+
# try:
|
| 81 |
+
# response = await llamaindex_agent.run(question_text)
|
| 82 |
+
# print(f"Answered Task {task_id}: {response[:50]}...")
|
| 83 |
+
# return {"task_id": task_id, "submitted_answer": response}
|
| 84 |
+
# except Exception as e:
|
| 85 |
+
# if "client has been closed" in str(e) and attempt < 2:
|
| 86 |
+
# print(f"Retrying task {task_id} (attempt {attempt + 2})...")
|
| 87 |
+
# continue
|
| 88 |
+
# raise e
|
| 89 |
except Exception as e:
|
| 90 |
print(f"Error on Task {task_id}: {e}")
|
| 91 |
return {"task_id": task_id, "submitted_answer": f"AGENT ERROR: {e}"}
|