Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,7 @@ class RetryOpenAIModel(OpenAIModel):
|
|
| 38 |
|
| 39 |
except RateLimitError as e:
|
| 40 |
if attempt == max_attempts - 1:
|
| 41 |
-
print("
|
| 42 |
raise
|
| 43 |
|
| 44 |
retry_after = None
|
|
@@ -62,7 +62,7 @@ class RetryOpenAIModel(OpenAIModel):
|
|
| 62 |
wait_time = max(wait_time, 1)
|
| 63 |
|
| 64 |
print(
|
| 65 |
-
f"[
|
| 66 |
f"Waiting {wait_time} seconds before retry..."
|
| 67 |
)
|
| 68 |
|
|
@@ -101,9 +101,9 @@ class BasicAgent:
|
|
| 101 |
|
| 102 |
# Groq model
|
| 103 |
self.model = RetryOpenAIModel(
|
| 104 |
-
model_id="
|
| 105 |
-
api_base="https://
|
| 106 |
-
api_key=os.environ["
|
| 107 |
client_kwargs={
|
| 108 |
"timeout": 60.0,
|
| 109 |
"max_retries": 0
|
|
|
|
| 38 |
|
| 39 |
except RateLimitError as e:
|
| 40 |
if attempt == max_attempts - 1:
|
| 41 |
+
print("Rate limit: Maximum retries reached.")
|
| 42 |
raise
|
| 43 |
|
| 44 |
retry_after = None
|
|
|
|
| 62 |
wait_time = max(wait_time, 1)
|
| 63 |
|
| 64 |
print(
|
| 65 |
+
f"[429] Attempt {attempt + 1}/{max_attempts}. "
|
| 66 |
f"Waiting {wait_time} seconds before retry..."
|
| 67 |
)
|
| 68 |
|
|
|
|
| 101 |
|
| 102 |
# Groq model
|
| 103 |
self.model = RetryOpenAIModel(
|
| 104 |
+
model_id="swiss-ai/Apertus-70B-Instruct-2509:publicai",
|
| 105 |
+
api_base="https://router.huggingface.co/v1",
|
| 106 |
+
api_key=os.environ["HF_TOKEN"],
|
| 107 |
client_kwargs={
|
| 108 |
"timeout": 60.0,
|
| 109 |
"max_retries": 0
|