Imnotchis commited on
Commit
102e6cf
·
verified ·
1 Parent(s): ac93ca7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -454,7 +454,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
454
 
455
  results_log = []
456
  answers_payload = []
457
- daily_quota_exhausted = 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,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 daily_quota_exhausted:
488
- print(f"[SKIPPED] Daily quota exhausted: {task_id}")
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 is_daily_quota_error(e):
516
- daily_quota_exhausted = True
517
- print("[QUOTA] Daily limit reached.")
518
- print("[QUOTA] Disabling further LLM calls.")
519
- print("[QUOTA] 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:
 
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: