Jofax commited on
Commit
eb53b1a
·
verified ·
1 Parent(s): 71111cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -1,7 +1,8 @@
1
  import os
2
  from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel
3
 
4
- # 1. THE BRAIN (PhD Reasoning)
 
5
  model = InferenceClientModel(
6
  model_id="deepseek-ai/DeepSeek-R1",
7
  token=os.getenv("HF_TOKEN")
@@ -12,22 +13,22 @@ researcher = CodeAgent(
12
  tools=[DuckDuckGoSearchTool()],
13
  model=model,
14
  name="research_specialist",
15
- description="Finds and summarizes web data with high precision."
16
  )
17
 
18
  # 3. THE BOSS (Manager)
19
- # This setup is 900% more efficient because the Manager focuses on
20
- # logic while the Specialist handles the search grunt-work.
21
  manager = CodeAgent(
22
  tools=[],
23
  model=model,
24
  managed_agents=[researcher],
25
  add_base_tools=True,
26
- system_prompt="""You are the BOSS OPERATOR.
27
- 1. For any task requiring web info, call your 'research_specialist'.
28
- 2. Use your internal Python tools for math and data processing.
29
- 3. Always verify data before presenting it.
30
- 4. Use LaTeX for math ($E=mc^2$) and Markdown for tables."""
31
  )
32
 
33
  if __name__ == "__main__":
 
1
  import os
2
  from smolagents import CodeAgent, DuckDuckGoSearchTool, GradioUI, InferenceClientModel
3
 
4
+ # 1. INITIALIZE THE BRAIN
5
+ # InferenceClientModel is the 2026 standard for HF API access.
6
  model = InferenceClientModel(
7
  model_id="deepseek-ai/DeepSeek-R1",
8
  token=os.getenv("HF_TOKEN")
 
13
  tools=[DuckDuckGoSearchTool()],
14
  model=model,
15
  name="research_specialist",
16
+ description="Expert at web search and data retrieval."
17
  )
18
 
19
  # 3. THE BOSS (Manager)
20
+ # We use 'instructions' to pass your PhD-level logic.
21
+ # We use 'managed_agents' to give the Boss control over the Specialist.
22
  manager = CodeAgent(
23
  tools=[],
24
  model=model,
25
  managed_agents=[researcher],
26
  add_base_tools=True,
27
+ instructions="""You are the BOSS OPERATOR (Elite PhD Level).
28
+ 1. Delegate sub-tasks to 'research_specialist' for any web-based data.
29
+ 2. Use your internal Python tools for calculation, logic, and data processing.
30
+ 3. Use LaTeX for all mathematical formulas ($E=mc^2$).
31
+ 4. Provide clear, data-backed conclusions in Markdown tables."""
32
  )
33
 
34
  if __name__ == "__main__":