Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import re
|
| 3 |
import json
|
| 4 |
import io
|
|
|
|
| 5 |
import traceback
|
| 6 |
import contextlib
|
| 7 |
import tempfile
|
|
@@ -12,8 +13,19 @@ import pandas as pd
|
|
| 12 |
|
| 13 |
# --- Constants ---
|
| 14 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
# ---------------------------------------------------------------------------
|
|
|
|
| 2 |
import re
|
| 3 |
import json
|
| 4 |
import io
|
| 5 |
+
import time
|
| 6 |
import traceback
|
| 7 |
import contextlib
|
| 8 |
import tempfile
|
|
|
|
| 13 |
|
| 14 |
# --- Constants ---
|
| 15 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 16 |
+
# Primary model first, then fallbacks used when rate-limited.
|
| 17 |
+
# llama-3.1-8b-instant has much higher daily token quota on the free tier.
|
| 18 |
+
GROQ_MODELS = [
|
| 19 |
+
m.strip()
|
| 20 |
+
for m in os.getenv(
|
| 21 |
+
"GROQ_MODELS",
|
| 22 |
+
"llama-3.3-70b-versatile,llama-3.1-8b-instant",
|
| 23 |
+
).split(",")
|
| 24 |
+
if m.strip()
|
| 25 |
+
]
|
| 26 |
+
MAX_TOOL_ITERATIONS = 6
|
| 27 |
+
TOOL_RESULT_MAX_CHARS = 3000
|
| 28 |
+
ANSWER_CACHE_PATH = os.getenv("ANSWER_CACHE_PATH", "answers_cache.json")
|
| 29 |
|
| 30 |
|
| 31 |
# ---------------------------------------------------------------------------
|