Thanh Vinh Vo commited on
Commit
9440a2b
·
1 Parent(s): 48dcf71
Files changed (2) hide show
  1. app.py +31 -3
  2. requirements.txt +1 -0
app.py CHANGED
@@ -64,9 +64,11 @@ class BasicAgent:
64
  model_id="meta-llama/Llama-3.2-11B-Vision-Instruct",
65
  )
66
 
67
- self.agent = CodeAgent(
68
  tools=[VisitWebpageTool(), DuckDuckGoSearchTool(), get_image_content],
69
- model=model,
 
 
70
  additional_authorized_imports=[
71
  "requests",
72
  "bs4",
@@ -75,7 +77,33 @@ class BasicAgent:
75
  "pandas",
76
  "io",
77
  "PIL",
 
78
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  )
80
 
81
  def __call__(self, question: str, file_name: str) -> str:
@@ -89,7 +117,7 @@ class BasicAgent:
89
  2. `pandas` Python package is provided. Please use it when there is need to extract structured data (such as tables) from HTML content.
90
  3. Please take the question literally! Do not add any additional information or assumptions.
91
  """
92
- result = self.agent.run(prompt)
93
  print(f"Agent responded with: {result}")
94
  return result
95
 
 
64
  model_id="meta-llama/Llama-3.2-11B-Vision-Instruct",
65
  )
66
 
67
+ self.multimodal_agent = CodeAgent(
68
  tools=[VisitWebpageTool(), DuckDuckGoSearchTool(), get_image_content],
69
+ model=InferenceClientModel(
70
+ model_id="meta-llama/Llama-3.2-11B-Vision-Instruct",
71
+ ),
72
  additional_authorized_imports=[
73
  "requests",
74
  "bs4",
 
77
  "pandas",
78
  "io",
79
  "PIL",
80
+ "chess",
81
  ],
82
+ name="multimodal_agent",
83
+ description="I can understand natural language and answer questions about images.",
84
+ verbosity_level=0,
85
+ max_steps=10,
86
+ )
87
+
88
+ self.manager_agent = CodeAgent(
89
+ model=InferenceClientModel(
90
+ "deepseek-ai/DeepSeek-R1", provider="together", max_tokens=8096
91
+ ),
92
+ tools=[get_image_content],
93
+ managed_agents=[self.multimodal_agent],
94
+ additional_authorized_imports=[
95
+ "requests",
96
+ "bs4",
97
+ "markdownify",
98
+ "wikipedia",
99
+ "pandas",
100
+ "io",
101
+ "PIL",
102
+ "chess",
103
+ ],
104
+ planning_interval=5,
105
+ verbosity_level=2,
106
+ max_steps=15,
107
  )
108
 
109
  def __call__(self, question: str, file_name: str) -> str:
 
117
  2. `pandas` Python package is provided. Please use it when there is need to extract structured data (such as tables) from HTML content.
118
  3. Please take the question literally! Do not add any additional information or assumptions.
119
  """
120
+ result = self.manager_agent.run(prompt)
121
  print(f"Agent responded with: {result}")
122
  return result
123
 
requirements.txt CHANGED
@@ -7,3 +7,4 @@ markdownify
7
  wikipedia
8
  pandas
9
  openai
 
 
7
  wikipedia
8
  pandas
9
  openai
10
+ chess