Update app.py
Browse files
app.py
CHANGED
|
@@ -21,8 +21,25 @@ class BasicAgent:
|
|
| 21 |
model=InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
|
| 22 |
max_steps=6,
|
| 23 |
)
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 28 |
"""
|
|
|
|
| 21 |
model=InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct"),
|
| 22 |
max_steps=6,
|
| 23 |
)
|
| 24 |
+
self.agent = CodeAgent(
|
| 25 |
+
tools=[DuckDuckGoSearchTool(), WikipediaSearchTool()],
|
| 26 |
+
model=...,
|
| 27 |
+
max_steps=12,
|
| 28 |
+
additional_authorized_imports=["pandas", "numpy"],
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
SYSTEM_HINT = """Answer with ONLY the final answer — no explanation, no units unless asked,
|
| 32 |
+
no leading articles. If it's a number, write digits. If it's a list, comma-separated."""
|
| 33 |
+
|
| 34 |
+
def __call__(self, question: str) -> str:
|
| 35 |
+
try:
|
| 36 |
+
return str(self.agent.run(f"{SYSTEM_HINT}\n\nQuestion: {question}"))
|
| 37 |
+
except Exception:
|
| 38 |
+
return "unable to answer"
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
|
| 44 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 45 |
"""
|