Thanh Vinh Vo commited on
Commit
30f6fbf
·
1 Parent(s): cfcc887
Files changed (1) hide show
  1. app.py +10 -37
app.py CHANGED
@@ -156,11 +156,14 @@ class BasicAgent:
156
  max_steps=10,
157
  )
158
 
159
- self.code_agent = CodeAgent(
160
  tools=[VisitWebpageTool(), DuckDuckGoSearchTool(), get_image, get_text_file],
161
  model=InferenceClientModel(
162
  model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
163
  ),
 
 
 
164
  additional_authorized_imports=[
165
  "requests",
166
  "bs4",
@@ -185,52 +188,22 @@ class BasicAgent:
185
  - Browse the web to find information.
186
  - Solving chess problems.
187
 
188
- Please follow hints below:
189
- 1. `pandas` Python package is provided. Please try to use it FIRST when there is need to extract structured data (such as tables) from HTML content.
190
- 2. `wikipedia` Python package is provided to interact with Wikipedia. Try to work with raw wikipedia HTML content and use `pandas` to parse first.
191
- 3. `chess` Python package is provided. Please use it when there is need to solve chess problems.
192
- 4. Please take the question literally! Do not add any additional information or assumptions.
193
  """,
194
  verbosity_level=0,
195
  max_steps=10,
196
  )
197
 
198
- self.manager_agent = CodeAgent(
199
- model=InferenceClientModel(
200
- "Qwen/Qwen2.5-32B-Instruct"
201
- ),
202
- tools=[get_image, get_text_file, VisitWebpageTool(), DuckDuckGoSearchTool()],
203
- managed_agents=[
204
- self.multimodal_agent,
205
- self.code_agent],
206
- additional_authorized_imports=[
207
- "requests",
208
- "bs4",
209
- "markdownify",
210
- "wikipedia",
211
- "pandas",
212
- "io",
213
- "PIL",
214
- "chess",
215
- "img2text",
216
- "chess.pgn",
217
- "PIL.Image",
218
- "bytes",
219
- "cv2",
220
- "numpy",
221
- "chess.engine",
222
- ],
223
- planning_interval=5,
224
- max_steps=15,
225
- )
226
-
227
  def __call__(self, question: str, question_id: str, has_file: bool) -> str:
228
  print(f"Agent received question: {question}")
229
  prompt = f"""
230
  Answer the following question:
231
  "{question} {"The file name for this question is: " if has_file else ""} {question_id if has_file else ""}"
232
- Please follow hints below:
233
- 1. Try to use managed agents to answer the question first.
 
 
 
234
  """
235
  result = self.manager_agent.run(prompt)
236
  print(f"Agent responded with: {result}")
 
156
  max_steps=10,
157
  )
158
 
159
+ self.manager_agent = CodeAgent(
160
  tools=[VisitWebpageTool(), DuckDuckGoSearchTool(), get_image, get_text_file],
161
  model=InferenceClientModel(
162
  model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
163
  ),
164
+ managed_agents=[
165
+ self.multimodal_agent
166
+ ],
167
  additional_authorized_imports=[
168
  "requests",
169
  "bs4",
 
188
  - Browse the web to find information.
189
  - Solving chess problems.
190
 
191
+
 
 
 
 
192
  """,
193
  verbosity_level=0,
194
  max_steps=10,
195
  )
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  def __call__(self, question: str, question_id: str, has_file: bool) -> str:
198
  print(f"Agent received question: {question}")
199
  prompt = f"""
200
  Answer the following question:
201
  "{question} {"The file name for this question is: " if has_file else ""} {question_id if has_file else ""}"
202
+ Please follow hints below:
203
+ 1. `pandas` Python package is provided. Please try to use it FIRST when there is need to extract structured data (such as tables) from HTML content.
204
+ 2. `wikipedia` Python package is provided to interact with Wikipedia. Try to work with raw wikipedia HTML content and use `pandas` to parse first.
205
+ 3. `chess` Python package is provided. Please use it when there is need to solve chess problems.
206
+ 4. Please take the question literally! Do not add any additional information or assumptions.
207
  """
208
  result = self.manager_agent.run(prompt)
209
  print(f"Agent responded with: {result}")