Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -454,7 +454,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 454 |
|
| 455 |
results_log = []
|
| 456 |
answers_payload = []
|
| 457 |
-
|
| 458 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 459 |
for item in questions_data:
|
| 460 |
task_id = item.get("task_id")
|
|
@@ -484,8 +484,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 484 |
submitted_answer = saved_answers[task_id]
|
| 485 |
print(f"[CACHE] Using answer for {task_id}")
|
| 486 |
|
| 487 |
-
elif
|
| 488 |
-
print(f"[SKIPPED]
|
| 489 |
continue
|
| 490 |
|
| 491 |
else:
|
|
@@ -512,11 +512,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 512 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 513 |
except Exception as e:
|
| 514 |
print(f"Error running agent on task {task_id}: {e}")
|
| 515 |
-
if
|
| 516 |
-
|
| 517 |
-
print("[
|
| 518 |
-
print("[
|
| 519 |
-
print("[
|
| 520 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
| 521 |
|
| 522 |
if not answers_payload:
|
|
|
|
| 454 |
|
| 455 |
results_log = []
|
| 456 |
answers_payload = []
|
| 457 |
+
llm_unavailable = False
|
| 458 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 459 |
for item in questions_data:
|
| 460 |
task_id = item.get("task_id")
|
|
|
|
| 484 |
submitted_answer = saved_answers[task_id]
|
| 485 |
print(f"[CACHE] Using answer for {task_id}")
|
| 486 |
|
| 487 |
+
elif llm_unavailable:
|
| 488 |
+
print(f"[SKIPPED] LLM unavailable: {task_id}")
|
| 489 |
continue
|
| 490 |
|
| 491 |
else:
|
|
|
|
| 512 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 513 |
except Exception as e:
|
| 514 |
print(f"Error running agent on task {task_id}: {e}")
|
| 515 |
+
if isinstance(e, RateLimitError) or "429" in str(e):
|
| 516 |
+
llm_unavailable = True
|
| 517 |
+
print("[429] Rate limit reached.")
|
| 518 |
+
print("[429] Stopping further LLM calls in this run.")
|
| 519 |
+
print("[CACHE] Continuing with cached answers only.")
|
| 520 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
| 521 |
|
| 522 |
if not answers_payload:
|