RozzaCreat commited on
Commit
0d2c0c6
·
verified ·
1 Parent(s): 4d7a951

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
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
- def __call__(self, question: str) -> str:
25
- return str(self.agent.run(question))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
  """