kuzumab commited on
Commit
754e573
·
verified ·
1 Parent(s): e0e4fce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -13
app.py CHANGED
@@ -18,7 +18,7 @@ class AttachmentDownloadTool(Tool):
18
  "description": "task_id that needs to download attachment files."
19
  }
20
  }
21
- output_type = "bytes"
22
 
23
  def forward(self, task_id):
24
  download_url = f"{DEFAULT_API_URL}/files/"
@@ -40,7 +40,7 @@ class ImageCaptionTool(Tool):
40
  "description": "Images that need to be identified and described"
41
  }
42
  }
43
- output_type = "str"
44
 
45
  def setup(self):
46
  self.model = OpenAIServerModel(
@@ -68,7 +68,7 @@ class AudioToTextTool(Tool):
68
  "description": "The audio file that needs to be transcribed"
69
  }
70
  }
71
- output_type = "str"
72
 
73
  def setup(self):
74
  # 使用 HuggingFace Hub 上的 Whisper 大模型
@@ -114,20 +114,20 @@ class BasicAgent:
114
  attachment_tool=AttachmentDownloadTool()
115
  image_tool=ImageCaptionTool()
116
  audio_tool=AudioToTextTool()
117
- self.tools = [attachment_tool,image_tool,audio_tool,DuckDuckGoSearchTool(), VisitWebpageTool()]
118
-
119
- # web_agent = ToolCallingAgent(
120
- # tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
121
- # model=self.base_model,
122
- # max_steps=10,
123
- # name="web_search_agent",
124
- # description="Runs web searches for you.",
125
- # )
126
 
127
  self.agent = CodeAgent(
128
  tools=self.tools,
129
  model=self.think_model,
130
- # managed_agents=[web_agent],
131
  additional_authorized_imports=["time", "numpy", "pandas"],
132
  max_steps=20
133
  )
 
18
  "description": "task_id that needs to download attachment files."
19
  }
20
  }
21
+ output_type = "any"
22
 
23
  def forward(self, task_id):
24
  download_url = f"{DEFAULT_API_URL}/files/"
 
40
  "description": "Images that need to be identified and described"
41
  }
42
  }
43
+ output_type = "string"
44
 
45
  def setup(self):
46
  self.model = OpenAIServerModel(
 
68
  "description": "The audio file that needs to be transcribed"
69
  }
70
  }
71
+ output_type = "string"
72
 
73
  def setup(self):
74
  # 使用 HuggingFace Hub 上的 Whisper 大模型
 
114
  attachment_tool=AttachmentDownloadTool()
115
  image_tool=ImageCaptionTool()
116
  audio_tool=AudioToTextTool()
117
+ # self.tools = [attachment_tool,image_tool,audio_tool,DuckDuckGoSearchTool(), VisitWebpageTool()]
118
+ self.tools = [attachment_tool,image_tool,audio_tool]
119
+ web_agent = ToolCallingAgent(
120
+ tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
121
+ model=self.base_model,
122
+ max_steps=10,
123
+ name="web_search_agent",
124
+ description="Runs web searches for you.",
125
+ )
126
 
127
  self.agent = CodeAgent(
128
  tools=self.tools,
129
  model=self.think_model,
130
+ managed_agents=[web_agent],
131
  additional_authorized_imports=["time", "numpy", "pandas"],
132
  max_steps=20
133
  )