added InternalServerError handling, fixed bug
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from litellm import RateLimitError
|
| 7 |
|
| 8 |
from time import time, sleep
|
| 9 |
from agent import MyAgent
|
|
@@ -103,8 +103,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 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(65)
|
| 110 |
cooldown_attempts -= 1
|
|
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
+
from litellm import RateLimitError, InternalServerError
|
| 7 |
|
| 8 |
from time import time, sleep
|
| 9 |
from agent import MyAgent
|
|
|
|
| 103 |
while cooldown_attempts > 0:
|
| 104 |
try:
|
| 105 |
submitted_answer = agent(question_text, additional_data=additional_data)
|
| 106 |
+
cooldown_attempts = 0
|
| 107 |
break
|
| 108 |
+
except (RateLimitError, InternalServerError) as e:
|
| 109 |
print(f"cooldown due to {e}")
|
| 110 |
sleep(65)
|
| 111 |
cooldown_attempts -= 1
|