naive cooldown
Browse files
app.py
CHANGED
|
@@ -97,20 +97,25 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 97 |
"Content-Length": response.headers['Content-Length'],
|
| 98 |
"content": response.content}
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
|
|
|
|
|
|
| 111 |
|
| 112 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 113 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
|
|
|
|
|
|
|
| 114 |
except Exception as e:
|
| 115 |
print(f"Error running agent on task {task_id}: {e}")
|
| 116 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
|
| 97 |
"Content-Length": response.headers['Content-Length'],
|
| 98 |
"content": response.content}
|
| 99 |
|
| 100 |
+
submitted_answer = agent(question_text, additional_data=additional_data)
|
| 101 |
+
|
| 102 |
+
# cooldown_attempts = 2
|
| 103 |
+
# while cooldown_attempts > 0:
|
| 104 |
+
# try:
|
| 105 |
+
# submitted_answer = agent(question_text, additional_data=additional_data)
|
| 106 |
+
# break
|
| 107 |
+
# except RateLimitError as e:
|
| 108 |
+
# print(f"cooldown due to {e}")
|
| 109 |
+
# sleep(61)
|
| 110 |
+
# cooldown_attempts -= 1
|
| 111 |
+
# if cooldown_attempts == 0:
|
| 112 |
+
# raise e
|
| 113 |
|
| 114 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 115 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 116 |
+
|
| 117 |
+
# cooldown
|
| 118 |
+
sleep(60)
|
| 119 |
except Exception as e:
|
| 120 |
print(f"Error running agent on task {task_id}: {e}")
|
| 121 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|