Wendong-Fan commited on
Commit
0b6b23d
·
2 Parent(s): 2447e80 823b0b5

Merge branch 'main' into mcp_feature

Browse files
README.md CHANGED
@@ -122,7 +122,7 @@ https://private-user-images.githubusercontent.com/55657767/420212194-e813fc05-13
122
  - **Browser Automation**: Utilize the Playwright framework for simulating browser interactions, including scrolling, clicking, input handling, downloading, navigation, and more.
123
  - **Document Parsing**: Extract content from Word, Excel, PDF, and PowerPoint files, converting them into text or Markdown format.
124
  - **Code Execution**: Write and execute Python code using interpreter.
125
- - **Built-in Toolkits**: Access to a comprehensive set of built-in toolkits including ArxivToolkit, AudioAnalysisToolkit, CodeExecutionToolkit, DalleToolkit, DataCommonsToolkit, ExcelToolkit, GitHubToolkit, GoogleMapsToolkit, GoogleScholarToolkit, ImageAnalysisToolkit, MathToolkit, NetworkXToolkit, NotionToolkit, OpenAPIToolkit, RedditToolkit, SearchToolkit, SemanticScholarToolkit, SymPyToolkit, VideoAnalysisToolkit, WeatherToolkit, WebToolkit, and many more for specialized tasks.
126
 
127
  # 🛠️ Installation
128
 
@@ -362,7 +362,7 @@ OWL supports various toolkits that can be customized by modifying the `tools` li
362
  ```python
363
  # Configure toolkits
364
  tools = [
365
- *WebToolkit(headless=False).get_tools(), # Browser automation
366
  *VideoAnalysisToolkit(model=models["video"]).get_tools(),
367
  *AudioAnalysisToolkit().get_tools(), # Requires OpenAI Key
368
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
@@ -381,7 +381,7 @@ tools = [
381
  Key toolkits include:
382
 
383
  ### Multimodal Toolkits (Require multimodal model capabilities)
384
- - **WebToolkit**: Browser automation for web interaction and navigation
385
  - **VideoAnalysisToolkit**: Video processing and content analysis
386
  - **ImageAnalysisToolkit**: Image analysis and interpretation
387
 
@@ -399,11 +399,11 @@ To customize available tools:
399
 
400
  ```python
401
  # 1. Import toolkits
402
- from camel.toolkits import WebToolkit, SearchToolkit, CodeExecutionToolkit
403
 
404
  # 2. Configure tools list
405
  tools = [
406
- *WebToolkit(headless=True).get_tools(),
407
  SearchToolkit().search_wiki,
408
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
409
  ]
 
122
  - **Browser Automation**: Utilize the Playwright framework for simulating browser interactions, including scrolling, clicking, input handling, downloading, navigation, and more.
123
  - **Document Parsing**: Extract content from Word, Excel, PDF, and PowerPoint files, converting them into text or Markdown format.
124
  - **Code Execution**: Write and execute Python code using interpreter.
125
+ - **Built-in Toolkits**: Access to a comprehensive set of built-in toolkits including ArxivToolkit, AudioAnalysisToolkit, CodeExecutionToolkit, DalleToolkit, DataCommonsToolkit, ExcelToolkit, GitHubToolkit, GoogleMapsToolkit, GoogleScholarToolkit, ImageAnalysisToolkit, MathToolkit, NetworkXToolkit, NotionToolkit, OpenAPIToolkit, RedditToolkit, SearchToolkit, SemanticScholarToolkit, SymPyToolkit, VideoAnalysisToolkit, WeatherToolkit, BrowserToolkit, and many more for specialized tasks.
126
 
127
  # 🛠️ Installation
128
 
 
362
  ```python
363
  # Configure toolkits
364
  tools = [
365
+ *BrowserToolkit(headless=False).get_tools(), # Browser automation
366
  *VideoAnalysisToolkit(model=models["video"]).get_tools(),
367
  *AudioAnalysisToolkit().get_tools(), # Requires OpenAI Key
368
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
 
381
  Key toolkits include:
382
 
383
  ### Multimodal Toolkits (Require multimodal model capabilities)
384
+ - **BrowserToolkit**: Browser automation for web interaction and navigation
385
  - **VideoAnalysisToolkit**: Video processing and content analysis
386
  - **ImageAnalysisToolkit**: Image analysis and interpretation
387
 
 
399
 
400
  ```python
401
  # 1. Import toolkits
402
+ from camel.toolkits import BrowserToolkit, SearchToolkit, CodeExecutionToolkit
403
 
404
  # 2. Configure tools list
405
  tools = [
406
+ *BrowserToolkit(headless=True).get_tools(),
407
  SearchToolkit().search_wiki,
408
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
409
  ]
README_zh.md CHANGED
@@ -123,7 +123,7 @@ https://private-user-images.githubusercontent.com/55657767/420212194-e813fc05-13
123
  - **浏览器操作**:借助Playwright框架开发浏览器模拟交互,支持页面滚动、点击、输入、下载、历史回退等功能
124
  - **文件解析**:word、excel、PDF、PowerPoint信息提取,内容转文本/Markdown
125
  - **代码执行**:编写python代码,并使用解释器运行
126
- - **丰富工具包**:提供丰富的工具包,包括ArxivToolkit(学术论文检索)、AudioAnalysisToolkit(音频分析)、CodeExecutionToolkit(代码执行)、DalleToolkit(图像生成)、DataCommonsToolkit(数据共享)、ExcelToolkit(Excel处理)、GitHubToolkit(GitHub交互)、GoogleMapsToolkit(地图服务)、GoogleScholarToolkit(学术搜索)、ImageAnalysisToolkit(图像分析)、MathToolkit(数学计算)、NetworkXToolkit(图形分析)、NotionToolkit(Notion交互)、OpenAPIToolkit(API操作)、RedditToolkit(Reddit交互)、SearchToolkit(搜索服务)、SemanticScholarToolkit(语义学术搜索)、SymPyToolkit(符号计算)、VideoAnalysisToolkit(视频分析)、WeatherToolkit(天气查询)、WebToolkit(网页交互)等多种专业工具,满足各类特定任务需求。
127
 
128
  # 🛠️ 安装
129
 
@@ -356,7 +356,7 @@ OWL支持多种工具包,可通过修改脚本中的`tools`列表进行自定
356
  ```python
357
  # 配置工具包
358
  tools = [
359
- *WebToolkit(headless=False).get_tools(), # 浏览器自动化
360
  *VideoAnalysisToolkit(model=models["video"]).get_tools(),
361
  *AudioAnalysisToolkit().get_tools(), # 需要OpenAI API密钥
362
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
@@ -375,7 +375,7 @@ tools = [
375
  关键工具包包括:
376
 
377
  ### 多模态工具包(需要模型具备多模态能力)
378
- - **WebToolkit**:浏览器自动化,用于网页交互和导航
379
  - **VideoAnalysisToolkit**:视频处理和内容分析
380
  - **ImageAnalysisToolkit**:图像分析和解释
381
 
@@ -393,11 +393,11 @@ tools = [
393
 
394
  ```python
395
  # 1. 导入工具包
396
- from camel.toolkits import WebToolkit, SearchToolkit, CodeExecutionToolkit
397
 
398
  # 2. 配置工具列表
399
  tools = [
400
- *WebToolkit(headless=True).get_tools(),
401
  SearchToolkit().search_wiki,
402
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
403
  ]
 
123
  - **浏览器操作**:借助Playwright框架开发浏览器模拟交互,支持页面滚动、点击、输入、下载、历史回退等功能
124
  - **文件解析**:word、excel、PDF、PowerPoint信息提取,内容转文本/Markdown
125
  - **代码执行**:编写python代码,并使用解释器运行
126
+ - **丰富工具包**:提供丰富的工具包,包括ArxivToolkit(学术论文检索)、AudioAnalysisToolkit(音频分析)、CodeExecutionToolkit(代码执行)、DalleToolkit(图像生成)、DataCommonsToolkit(数据共享)、ExcelToolkit(Excel处理)、GitHubToolkit(GitHub交互)、GoogleMapsToolkit(地图服务)、GoogleScholarToolkit(学术搜索)、ImageAnalysisToolkit(图像分析)、MathToolkit(数学计算)、NetworkXToolkit(图形分析)、NotionToolkit(Notion交互)、OpenAPIToolkit(API操作)、RedditToolkit(Reddit交互)、SearchToolkit(搜索服务)、SemanticScholarToolkit(语义学术搜索)、SymPyToolkit(符号计算)、VideoAnalysisToolkit(视频分析)、WeatherToolkit(天气查询)、BrowserToolkit(网页交互)等多种专业工具,满足各类特定任务需求。
127
 
128
  # 🛠️ 安装
129
 
 
356
  ```python
357
  # 配置工具包
358
  tools = [
359
+ *BrowserToolkit(headless=False).get_tools(), # 浏览器自动化
360
  *VideoAnalysisToolkit(model=models["video"]).get_tools(),
361
  *AudioAnalysisToolkit().get_tools(), # 需要OpenAI API密钥
362
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
 
375
  关键工具包包括:
376
 
377
  ### 多模态工具包(需要模型具备多模态能力)
378
+ - **BrowserToolkit**:浏览器自动化,用于网页交互和导航
379
  - **VideoAnalysisToolkit**:视频处理和内容分析
380
  - **ImageAnalysisToolkit**:图像分析和解释
381
 
 
393
 
394
  ```python
395
  # 1. 导入工具包
396
+ from camel.toolkits import BrowserToolkit, SearchToolkit, CodeExecutionToolkit
397
 
398
  # 2. 配置工具列表
399
  tools = [
400
+ *BrowserToolkit(headless=True).get_tools(),
401
  SearchToolkit().search_wiki,
402
  *CodeExecutionToolkit(sandbox="subprocess").get_tools(),
403
  ]
owl/run.py CHANGED
@@ -20,7 +20,7 @@ from camel.toolkits import (
20
  ImageAnalysisToolkit,
21
  SearchToolkit,
22
  VideoAnalysisToolkit,
23
- WebToolkit,
24
  FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType, ModelType
@@ -84,7 +84,7 @@ def construct_society(question: str) -> OwlRolePlaying:
84
 
85
  # Configure toolkits
86
  tools = [
87
- *WebToolkit(
88
  headless=False, # Set to True for headless mode (e.g., on remote servers)
89
  web_agent_model=models["web"],
90
  planning_agent_model=models["planning"],
 
20
  ImageAnalysisToolkit,
21
  SearchToolkit,
22
  VideoAnalysisToolkit,
23
+ BrowserToolkit,
24
  FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType, ModelType
 
84
 
85
  # Configure toolkits
86
  tools = [
87
+ *BrowserToolkit(
88
  headless=False, # Set to True for headless mode (e.g., on remote servers)
89
  web_agent_model=models["web"],
90
  planning_agent_model=models["planning"],
owl/run_gaia_roleplaying.py CHANGED
@@ -26,7 +26,7 @@ from camel.toolkits import (
26
  ImageAnalysisToolkit,
27
  SearchToolkit,
28
  VideoAnalysisToolkit,
29
- WebToolkit,
30
  FileWriteToolkit,
31
  )
32
  from camel.types import ModelPlatformType, ModelType
@@ -91,7 +91,7 @@ def main():
91
 
92
  # Configure toolkits
93
  tools = [
94
- *WebToolkit(
95
  headless=False, # Set to True for headless mode (e.g., on remote servers)
96
  web_agent_model=models["web"],
97
  planning_agent_model=models["planning"],
 
26
  ImageAnalysisToolkit,
27
  SearchToolkit,
28
  VideoAnalysisToolkit,
29
+ BrowserToolkit,
30
  FileWriteToolkit,
31
  )
32
  from camel.types import ModelPlatformType, ModelType
 
91
 
92
  # Configure toolkits
93
  tools = [
94
+ *BrowserToolkit(
95
  headless=False, # Set to True for headless mode (e.g., on remote servers)
96
  web_agent_model=models["web"],
97
  planning_agent_model=models["planning"],
owl/run_mini.py CHANGED
@@ -16,7 +16,7 @@ from dotenv import load_dotenv
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
- WebToolkit,
20
  FileWriteToolkit,
21
  )
22
  from camel.types import ModelPlatformType, ModelType
@@ -65,7 +65,7 @@ def construct_society(question: str) -> OwlRolePlaying:
65
 
66
  # Configure toolkits
67
  tools = [
68
- *WebToolkit(
69
  headless=False, # Set to True for headless mode (e.g., on remote servers)
70
  web_agent_model=models["web"],
71
  planning_agent_model=models["planning"],
 
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
+ BrowserToolkit,
20
  FileWriteToolkit,
21
  )
22
  from camel.types import ModelPlatformType, ModelType
 
65
 
66
  # Configure toolkits
67
  tools = [
68
+ *BrowserToolkit(
69
  headless=False, # Set to True for headless mode (e.g., on remote servers)
70
  web_agent_model=models["web"],
71
  planning_agent_model=models["planning"],
owl/run_ollama.py CHANGED
@@ -20,7 +20,7 @@ from camel.toolkits import (
20
  ExcelToolkit,
21
  ImageAnalysisToolkit,
22
  SearchToolkit,
23
- WebToolkit,
24
  FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType
@@ -80,7 +80,7 @@ def construct_society(question: str) -> OwlRolePlaying:
80
 
81
  # Configure toolkits
82
  tools = [
83
- *WebToolkit(
84
  headless=False, # Set to True for headless mode (e.g., on remote servers)
85
  web_agent_model=models["web"],
86
  planning_agent_model=models["planning"],
 
20
  ExcelToolkit,
21
  ImageAnalysisToolkit,
22
  SearchToolkit,
23
+ BrowserToolkit,
24
  FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType
 
80
 
81
  # Configure toolkits
82
  tools = [
83
+ *BrowserToolkit(
84
  headless=False, # Set to True for headless mode (e.g., on remote servers)
85
  web_agent_model=models["web"],
86
  planning_agent_model=models["planning"],
owl/run_openai_compatiable_model.py CHANGED
@@ -20,7 +20,7 @@ from camel.toolkits import (
20
  ExcelToolkit,
21
  ImageAnalysisToolkit,
22
  SearchToolkit,
23
- WebToolkit,
24
  FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType
@@ -85,7 +85,7 @@ def construct_society(question: str) -> OwlRolePlaying:
85
 
86
  # Configure toolkits
87
  tools = [
88
- *WebToolkit(
89
  headless=False, # Set to True for headless mode (e.g., on remote servers)
90
  web_agent_model=models["web"],
91
  planning_agent_model=models["planning"],
 
20
  ExcelToolkit,
21
  ImageAnalysisToolkit,
22
  SearchToolkit,
23
+ BrowserToolkit,
24
  FileWriteToolkit,
25
  )
26
  from camel.types import ModelPlatformType
 
85
 
86
  # Configure toolkits
87
  tools = [
88
+ *BrowserToolkit(
89
  headless=False, # Set to True for headless mode (e.g., on remote servers)
90
  web_agent_model=models["web"],
91
  planning_agent_model=models["planning"],
owl/run_qwen_mini_zh.py CHANGED
@@ -19,7 +19,7 @@
19
  from dotenv import load_dotenv
20
 
21
  from camel.models import ModelFactory
22
- from camel.toolkits import WebToolkit, SearchToolkit, FileWriteToolkit
23
  from camel.types import ModelPlatformType, ModelType
24
 
25
  from utils import OwlRolePlaying, run_society
@@ -62,7 +62,7 @@ def construct_society(question: str) -> OwlRolePlaying:
62
  )
63
 
64
  tools_list = [
65
- *WebToolkit(
66
  headless=False,
67
  web_agent_model=web_model,
68
  planning_agent_model=planning_model,
 
19
  from dotenv import load_dotenv
20
 
21
  from camel.models import ModelFactory
22
+ from camel.toolkits import BrowserToolkit, SearchToolkit, FileWriteToolkit
23
  from camel.types import ModelPlatformType, ModelType
24
 
25
  from utils import OwlRolePlaying, run_society
 
62
  )
63
 
64
  tools_list = [
65
+ *BrowserToolkit(
66
  headless=False,
67
  web_agent_model=web_model,
68
  planning_agent_model=planning_model,
owl/run_qwen_zh.py CHANGED
@@ -24,7 +24,7 @@ from camel.toolkits import (
24
  ImageAnalysisToolkit,
25
  SearchToolkit,
26
  VideoAnalysisToolkit,
27
- WebToolkit,
28
  FileWriteToolkit,
29
  )
30
  from camel.types import ModelPlatformType, ModelType
@@ -90,7 +90,7 @@ def construct_society(question: str) -> OwlRolePlaying:
90
 
91
  # Configure toolkits
92
  tools = [
93
- *WebToolkit(
94
  headless=False, # Set to True for headless mode (e.g., on remote servers)
95
  web_agent_model=models["web"],
96
  planning_agent_model=models["planning"],
 
24
  ImageAnalysisToolkit,
25
  SearchToolkit,
26
  VideoAnalysisToolkit,
27
+ BrowserToolkit,
28
  FileWriteToolkit,
29
  )
30
  from camel.types import ModelPlatformType, ModelType
 
90
 
91
  # Configure toolkits
92
  tools = [
93
+ *BrowserToolkit(
94
  headless=False, # Set to True for headless mode (e.g., on remote servers)
95
  web_agent_model=models["web"],
96
  planning_agent_model=models["planning"],
owl/run_terminal.py CHANGED
@@ -16,7 +16,7 @@ import os
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
- WebToolkit,
20
  FileWriteToolkit,
21
  TerminalToolkit
22
  )
@@ -67,7 +67,7 @@ def construct_society(question: str) -> OwlRolePlaying:
67
 
68
  # Configure toolkits
69
  tools = [
70
- *WebToolkit(
71
  headless=False, # Set to True for headless mode (e.g., on remote servers)
72
  web_agent_model=models["web"],
73
  planning_agent_model=models["planning"],
 
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
+ BrowserToolkit,
20
  FileWriteToolkit,
21
  TerminalToolkit
22
  )
 
67
 
68
  # Configure toolkits
69
  tools = [
70
+ *BrowserToolkit(
71
  headless=False, # Set to True for headless mode (e.g., on remote servers)
72
  web_agent_model=models["web"],
73
  planning_agent_model=models["planning"],
owl/run_terminal_zh.py CHANGED
@@ -16,7 +16,7 @@ from dotenv import load_dotenv
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
- WebToolkit,
20
  FileWriteToolkit,
21
  TerminalToolkit
22
  )
@@ -68,7 +68,7 @@ def construct_society(question: str) -> OwlRolePlaying:
68
 
69
  # Configure toolkits
70
  tools = [
71
- *WebToolkit(
72
  headless=False, # Set to True for headless mode (e.g., on remote servers)
73
  web_agent_model=models["web"],
74
  planning_agent_model=models["planning"],
 
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
+ BrowserToolkit,
20
  FileWriteToolkit,
21
  TerminalToolkit
22
  )
 
68
 
69
  # Configure toolkits
70
  tools = [
71
+ *BrowserToolkit(
72
  headless=False, # Set to True for headless mode (e.g., on remote servers)
73
  web_agent_model=models["web"],
74
  planning_agent_model=models["planning"],
owl/utils/document_toolkit.py CHANGED
@@ -144,12 +144,11 @@ class DocumentProcessingToolkit(BaseToolkit):
144
  return True, extracted_text
145
  try:
146
  result = asyncio.run(self._extract_content_with_chunkr(document_path))
147
- raise ValueError("Chunkr is not available.")
148
  return True, result
149
 
150
  except Exception as e:
151
  logger.warning(
152
- f"Error occurred while using chunkr to process document: {e}"
153
  )
154
  if document_path.endswith(".pdf"):
155
  # try using pypdf to extract text from pdf
@@ -226,7 +225,7 @@ class DocumentProcessingToolkit(BaseToolkit):
226
 
227
  if result.status == "Failed":
228
  logger.error(
229
- f"Error while processing document {document_path}: {result.message}"
230
  )
231
  return f"Error while processing document: {result.message}"
232
 
 
144
  return True, extracted_text
145
  try:
146
  result = asyncio.run(self._extract_content_with_chunkr(document_path))
 
147
  return True, result
148
 
149
  except Exception as e:
150
  logger.warning(
151
+ f"Error occurred while using Chunkr to process document: {e}"
152
  )
153
  if document_path.endswith(".pdf"):
154
  # try using pypdf to extract text from pdf
 
225
 
226
  if result.status == "Failed":
227
  logger.error(
228
+ f"Error while processing document {document_path}: {result.message} using Chunkr."
229
  )
230
  return f"Error while processing document: {result.message}"
231
 
owl/utils/gaia.py CHANGED
@@ -191,15 +191,10 @@ class GAIABenchmark(BaseBenchmark):
191
  except Exception as e:
192
  logger.warning(e)
193
  # raise FileNotFoundError(f"{self.save_to} does not exist.")
194
-
 
195
  # Process tasks
196
  for task in tqdm(datas, desc="Running"):
197
- if self._check_task_completed(task["task_id"]):
198
- logger.info(
199
- f"The following task is already completed:\n task id: {task['task_id']}, question: {task['Question']}"
200
- )
201
- continue
202
-
203
  if_prepared_task, info = self._prepare_task(task)
204
  if not if_prepared_task:
205
  _result_info = {
 
191
  except Exception as e:
192
  logger.warning(e)
193
  # raise FileNotFoundError(f"{self.save_to} does not exist.")
194
+ datas = [data for data in datas if not self._check_task_completed(data["task_id"])]
195
+ logger.info(f"Number of tasks to be processed: {len(datas)}")
196
  # Process tasks
197
  for task in tqdm(datas, desc="Running"):
 
 
 
 
 
 
198
  if_prepared_task, info = self._prepare_task(task)
199
  if not if_prepared_task:
200
  _result_info = {