Raj commited on
Upload 2 files
Browse files
agent.py
CHANGED
|
@@ -137,11 +137,13 @@ class GaiaAgent:
|
|
| 137 |
|
| 138 |
# 2) Self-consistency: N independent CodeAgent runs.
|
| 139 |
candidates: list[str] = []
|
|
|
|
| 140 |
for i in range(self._n):
|
| 141 |
try:
|
| 142 |
raw = self._single_run(question, task_id, attachment_line)
|
| 143 |
except Exception as e:
|
| 144 |
-
|
|
|
|
| 145 |
continue
|
| 146 |
norm = self._normalize(str(raw))
|
| 147 |
print(f" attempt {i + 1}: {norm!r}")
|
|
@@ -149,7 +151,7 @@ class GaiaAgent:
|
|
| 149 |
candidates.append(norm)
|
| 150 |
|
| 151 |
if not candidates:
|
| 152 |
-
return "AGENT ERROR:
|
| 153 |
|
| 154 |
# 3) Majority vote on normalized strings (case-insensitive bucket).
|
| 155 |
voted = self._vote(candidates)
|
|
|
|
| 137 |
|
| 138 |
# 2) Self-consistency: N independent CodeAgent runs.
|
| 139 |
candidates: list[str] = []
|
| 140 |
+
last_error: Optional[str] = None
|
| 141 |
for i in range(self._n):
|
| 142 |
try:
|
| 143 |
raw = self._single_run(question, task_id, attachment_line)
|
| 144 |
except Exception as e:
|
| 145 |
+
last_error = f"{type(e).__name__}: {e}"
|
| 146 |
+
print(f" attempt {i + 1} errored: {last_error}")
|
| 147 |
continue
|
| 148 |
norm = self._normalize(str(raw))
|
| 149 |
print(f" attempt {i + 1}: {norm!r}")
|
|
|
|
| 151 |
candidates.append(norm)
|
| 152 |
|
| 153 |
if not candidates:
|
| 154 |
+
return f"AGENT ERROR: all {self._n} attempts failed. Last error: {last_error}"
|
| 155 |
|
| 156 |
# 3) Majority vote on normalized strings (case-insensitive bucket).
|
| 157 |
voted = self._vote(candidates)
|
config.py
CHANGED
|
@@ -28,8 +28,8 @@ def _env(name: str, default: str) -> str:
|
|
| 28 |
# - "Qwen/Qwen2.5-72B-Instruct" (provider="auto")
|
| 29 |
# - "meta-llama/Llama-3.3-70B-Instruct" (provider="auto")
|
| 30 |
# - "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" (reasoning-tuned)
|
| 31 |
-
AGENT_MODEL_ID = _env("AGENT_MODEL_ID", "
|
| 32 |
-
AGENT_PROVIDER = _env("AGENT_PROVIDER", "
|
| 33 |
AGENT_MAX_TOKENS = int(_env("AGENT_MAX_TOKENS", "4096"))
|
| 34 |
|
| 35 |
# ---------------------------------------------------------------------------
|
|
|
|
| 28 |
# - "Qwen/Qwen2.5-72B-Instruct" (provider="auto")
|
| 29 |
# - "meta-llama/Llama-3.3-70B-Instruct" (provider="auto")
|
| 30 |
# - "deepseek-ai/DeepSeek-R1-Distill-Llama-70B" (reasoning-tuned)
|
| 31 |
+
AGENT_MODEL_ID = _env("AGENT_MODEL_ID", "Qwen/Qwen2.5-72B-Instruct")
|
| 32 |
+
AGENT_PROVIDER = _env("AGENT_PROVIDER", "auto")
|
| 33 |
AGENT_MAX_TOKENS = int(_env("AGENT_MAX_TOKENS", "4096"))
|
| 34 |
|
| 35 |
# ---------------------------------------------------------------------------
|