Alopezcordero commited on
Commit
7d7cf44
·
verified ·
1 Parent(s): 797ecd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -30,7 +30,7 @@ def read_files(file_path: str) -> str:
30
  return path.read_text()
31
  elif path.suffix == ".csv" or path.suffix == ".xlsx" or path.suffix == ".xls":
32
  df = pd.read_csv(path) if path.suffix == ".csv" else pd.read_excel(path)
33
- return df.to_string()
34
  elif path.suffix == ".json":
35
  return path.read_text(encoding="utf-8")
36
  else:
@@ -40,7 +40,7 @@ class BasicAgent:
40
  def __init__(self):
41
  print("BasicAgent initialized.")
42
  model = InferenceClientModel(
43
- model_id="Qwen/Qwen3-235B-A22B",
44
  token=os.getenv("HF_TOKEN")
45
  )
46
  web_agent = ToolCallingAgent(
@@ -48,11 +48,22 @@ class BasicAgent:
48
  model=model,
49
  max_steps=5,
50
  name="web_agent",
51
- description="this agent can search the web"
 
 
 
 
 
 
 
 
 
 
 
52
  )
53
  #create a manager agent that can manage multiple agents
54
  self.agent = CodeAgent(
55
- tools=[read_files],
56
  model=model,
57
  managed_agents=[web_agent],
58
  additional_authorized_imports = ["math", "random", "datetime", "json", "re", "statistics", "pandas"],
@@ -83,6 +94,7 @@ class BasicAgent:
83
  9. Use web search for factual questions.
84
  10. If uncertain, still give best concise answer.
85
  11. NEVER include any extra text before or after the answer.
 
86
 
87
  BAD:
88
  "The answer is 485"
 
30
  return path.read_text()
31
  elif path.suffix == ".csv" or path.suffix == ".xlsx" or path.suffix == ".xls":
32
  df = pd.read_csv(path) if path.suffix == ".csv" else pd.read_excel(path)
33
+ return df.to_csv(index=False)
34
  elif path.suffix == ".json":
35
  return path.read_text(encoding="utf-8")
36
  else:
 
40
  def __init__(self):
41
  print("BasicAgent initialized.")
42
  model = InferenceClientModel(
43
+ model_id="Qwen/Qwen2.5-72B-Instruct",
44
  token=os.getenv("HF_TOKEN")
45
  )
46
  web_agent = ToolCallingAgent(
 
48
  model=model,
49
  max_steps=5,
50
  name="web_agent",
51
+ description="""
52
+ Use this agent for factual questions requiring web search.
53
+ Always use this for:
54
+ - Wikipedia questions.
55
+ - Dates.
56
+ - Names.
57
+ - Historical Facts.
58
+ - Videos.
59
+ - Rankings.
60
+ - Counts.
61
+ - Factual Retrieval
62
+ """
63
  )
64
  #create a manager agent that can manage multiple agents
65
  self.agent = CodeAgent(
66
+ tools=[read_files, DuckDuckGoSearchTool()],
67
  model=model,
68
  managed_agents=[web_agent],
69
  additional_authorized_imports = ["math", "random", "datetime", "json", "re", "statistics", "pandas"],
 
94
  9. Use web search for factual questions.
95
  10. If uncertain, still give best concise answer.
96
  11. NEVER include any extra text before or after the answer.
97
+ 12. If Attachment path is not None, call read_files before answering.
98
 
99
  BAD:
100
  "The answer is 485"