Wendong-Fan commited on
Commit
98ef7f1
·
1 Parent(s): ffd123e

update readme and format fix

Browse files
README.md CHANGED
@@ -122,7 +122,9 @@ 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, BrowserToolkit, and many more for specialized tasks.
 
 
126
 
127
  # 🛠️ Installation
128
 
@@ -275,6 +277,23 @@ For more detailed Docker usage instructions, including cross-platform support, o
275
 
276
  # 🚀 Quick Start
277
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  After installation and setting up your environment variables, you can start using OWL right away:
279
 
280
  ```bash
@@ -355,6 +374,14 @@ Here are some tasks you can try with OWL:
355
 
356
  # 🧰 Toolkits and Capabilities
357
 
 
 
 
 
 
 
 
 
358
  > **Important**: Effective use of toolkits requires models with strong tool calling capabilities. For multimodal toolkits (Web, Image, Video), models must also have multimodal understanding abilities.
359
 
360
  OWL supports various toolkits that can be customized by modifying the `tools` list in your script:
 
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:
126
+ - **Model Context Protocol (MCP)**: A universal protocol layer that standardizes AI model interactions with various tools and data sources
127
+ - **Core Toolkits**: 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
128
 
129
  # 🛠️ Installation
130
 
 
277
 
278
  # 🚀 Quick Start
279
 
280
+ ## Try MCP (Model Context Protocol) Integration
281
+
282
+ Experience the power of MCP by running our example that demonstrates multi-agent information retrieval and processing:
283
+
284
+ ```bash
285
+ # Set up MCP servers (one-time setup)
286
+ npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
287
+ npx @wonderwhy-er/desktop-commander setup
288
+
289
+ # Run the MCP example
290
+ python owl/run_mcp.py
291
+ ```
292
+
293
+ This example showcases how OWL agents can seamlessly interact with file systems, web automation, and information retrieval through the MCP protocol. Check out `owl/run_mcp.py` for the full implementation.
294
+
295
+ ## Basic Usage
296
+
297
  After installation and setting up your environment variables, you can start using OWL right away:
298
 
299
  ```bash
 
374
 
375
  # 🧰 Toolkits and Capabilities
376
 
377
+ ## Model Context Protocol (MCP)
378
+
379
+ OWL's MCP integration provides a standardized way for AI models to interact with various tools and data sources:
380
+
381
+ Try our comprehensive MCP example in `owl/run_mcp.py` to see these capabilities in action!
382
+
383
+ ## Available Toolkits
384
+
385
  > **Important**: Effective use of toolkits requires models with strong tool calling capabilities. For multimodal toolkits (Web, Image, Video), models must also have multimodal understanding abilities.
386
 
387
  OWL supports various toolkits that can be customized by modifying the `tools` list in your script:
README_zh.md CHANGED
@@ -105,7 +105,7 @@
105
  </div>
106
 
107
  - **[2025.03.12]**: 在SearchToolkit中添加了Bocha搜索功能,集成了火山引擎模型平台,并更新了Azure和OpenAI Compatible模型的结构化输出和工具调用能力。
108
- - **[2025.03.11]**: 我们添加了 MCPToolkit、FileWriteToolkit 和 TerminalToolkit,增强 OWL Agent的工具调用、文件写入能力和终端命令执行功能。
109
  - **[2025.03.09]**: 我们添加了基于网页的用户界面,使系统交互变得更加简便。
110
  - **[2025.03.07]**: 我们开源了 🦉 OWL 项目的代码库。
111
  - **[2025.03.03]**: OWL 在 GAIA 基准测试中取得 58.18 平均分,在开源框架中排名第一!
@@ -272,6 +272,23 @@ chmod +x build_docker.sh
272
  更多详细的Docker使用说明,包括跨平台支持、优化配置和故障排除,请参阅 [DOCKER_README.md](.container/DOCKER_README.md)
273
 
274
  # 🚀 快速开始
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
 
276
  运行以下示例:
277
 
@@ -349,6 +366,14 @@ OWL 将自动调用与文档相关的工具来处理文件并提取答案。
349
 
350
  # 🧰 工具包与功能
351
 
 
 
 
 
 
 
 
 
352
  > **重要提示**:有效使用工具包需要具备强大工具调用能力的模型。对于多模态工具包(Web、图像、视频),模型还必须具备多模态理解能力。
353
 
354
  OWL支持多种工具包,可通过修改脚本中的`tools`列表进行自定义:
 
105
  </div>
106
 
107
  - **[2025.03.12]**: 在SearchToolkit中添加了Bocha搜索功能,集成了火山引擎模型平台,并更新了Azure和OpenAI Compatible模型的结构化输出和工具调用能力。
108
+ - **[2025.03.11]**: 我们添加了 MCPToolkit、FileWriteToolkit 和 TerminalToolkit,增强了 OWL Agent 的 MCP(模型上下文协议)集成、文件写入能力和终端命令执行功能。MCP 作为一个通用协议层,标准化了 AI 模型与各种数据源和工具的交互方式。
109
  - **[2025.03.09]**: 我们添加了基于网页的用户界面,使系统交互变得更加简便。
110
  - **[2025.03.07]**: 我们开源了 🦉 OWL 项目的代码库。
111
  - **[2025.03.03]**: OWL 在 GAIA 基准测试中取得 58.18 平均分,在开源框架中排名第一!
 
272
  更多详细的Docker使用说明,包括跨平台支持、优化配置和故障排除,请参阅 [DOCKER_README.md](.container/DOCKER_README.md)
273
 
274
  # 🚀 快速开始
275
+
276
+ ## 尝试 MCP(模型上下文协议)集成
277
+
278
+ 体验 MCP 的强大功能,运行我们的示例来展示多智能体信息检索和处理:
279
+
280
+ ```bash
281
+ # 设置 MCP 服务器(仅需一次性设置)
282
+ npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
283
+ npx @wonderwhy-er/desktop-commander setup
284
+
285
+ # 运行 MCP 示例
286
+ python owl/run_mcp.py
287
+ ```
288
+
289
+ 这个示例展示了 OWL 智能体如何通过 MCP 协议无缝地与文件系统、网页自动化和信息检索进行交互。查看 `owl/run_mcp.py` 了解完整实现。
290
+
291
+ ## 基本用法
292
 
293
  运行以下示例:
294
 
 
366
 
367
  # 🧰 工具包与功能
368
 
369
+ ## 模型上下文协议(MCP)
370
+
371
+ OWL 的 MCP 集成为 AI 模型与各种工具和数据源的交互提供了标准化的方式。
372
+
373
+ 查看我们的综合示例 `owl/run_mcp.py` 来体验这些功能!
374
+
375
+ ## 可用工具包
376
+
377
  > **重要提示**:有效使用工具包需要具备强大工具调用能力的模型。对于多模态工具包(Web、图像、视频),模型还必须具备多模态理解能力。
378
 
379
  OWL支持多种工具包,可通过修改脚本中的`tools`列表进行自定义:
owl/run_deepseek_zh.py CHANGED
@@ -31,7 +31,7 @@ from camel.toolkits import (
31
  from camel.types import ModelPlatformType, ModelType
32
 
33
 
34
- from utils import OwlRolePlaying, run_society, DocumentProcessingToolkit
35
 
36
  from camel.logger import set_log_level
37
 
@@ -99,9 +99,7 @@ def construct_society(question: str) -> OwlRolePlaying:
99
  def main():
100
  r"""Main function to run the OWL system with an example question."""
101
  # Example research question
102
- question = (
103
- "搜索OWL项目最近的新闻并生成一篇报告,最后保存到本地。"
104
- )
105
 
106
  # Construct and run the society
107
  society = construct_society(question)
 
31
  from camel.types import ModelPlatformType, ModelType
32
 
33
 
34
+ from utils import OwlRolePlaying, run_society
35
 
36
  from camel.logger import set_log_level
37
 
 
99
  def main():
100
  r"""Main function to run the OWL system with an example question."""
101
  # Example research question
102
+ question = "搜索OWL项目最近的新闻并生成一篇报告,最后保存到本地。"
 
 
103
 
104
  # Construct and run the society
105
  society = construct_society(question)
owl/run_mcp.py CHANGED
@@ -1,3 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  """MCP Multi-Agent System Example
2
 
3
  This example demonstrates how to use MCP (Model Context Protocol) with CAMEL agents
@@ -15,7 +28,7 @@ Environment Setup:
15
  # Install MCP service
16
  npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
17
  npx @wonderwhy-er/desktop-commander setup
18
-
19
  # Configure in owl/mcp_servers_config.json:
20
  {
21
  "desktop-commander": {
@@ -33,7 +46,7 @@ Environment Setup:
33
  # Install MCP service
34
  npm install -g @executeautomation/playwright-mcp-server
35
  npx playwright install-deps
36
-
37
  # Configure in mcp_servers_config.json:
38
  {
39
  "mcpServers": {
@@ -49,7 +62,7 @@ Environment Setup:
49
  ```bash
50
  # Install MCP service
51
  pip install mcp-server-fetch
52
-
53
  # Configure in mcp_servers_config.json:
54
  {
55
  "mcpServers": {
@@ -92,7 +105,6 @@ from camel.toolkits import MCPToolkit
92
  from utils.enhanced_role_playing import OwlRolePlaying, run_society
93
 
94
 
95
-
96
  load_dotenv()
97
  set_log_level(level="DEBUG")
98
 
@@ -150,7 +162,7 @@ async def main():
150
 
151
  question = (
152
  "I'd like a academic report about Andrew Ng, including his research "
153
- "direction, published papers (At least 3), institutions, etc."
154
  "Then organize the report in Markdown format and save it to my desktop"
155
  )
156
 
@@ -164,8 +176,9 @@ async def main():
164
  # Make sure to disconnect safely after all operations are completed.
165
  try:
166
  await mcp_toolkit.disconnect()
167
- except Exception as e:
168
- print(f"Warning: Error during disconnect: {e}")
 
169
 
170
  if __name__ == "__main__":
171
- asyncio.run(main())
 
1
+ # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
2
+ # Licensed under the Apache License, Version 2.0 (the "License");
3
+ # you may not use this file except in compliance with the License.
4
+ # You may obtain a copy of the License at
5
+ #
6
+ # http://www.apache.org/licenses/LICENSE-2.0
7
+ #
8
+ # Unless required by applicable law or agreed to in writing, software
9
+ # distributed under the License is distributed on an "AS IS" BASIS,
10
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ # See the License for the specific language governing permissions and
12
+ # limitations under the License.
13
+ # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  """MCP Multi-Agent System Example
15
 
16
  This example demonstrates how to use MCP (Model Context Protocol) with CAMEL agents
 
28
  # Install MCP service
29
  npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
30
  npx @wonderwhy-er/desktop-commander setup
31
+
32
  # Configure in owl/mcp_servers_config.json:
33
  {
34
  "desktop-commander": {
 
46
  # Install MCP service
47
  npm install -g @executeautomation/playwright-mcp-server
48
  npx playwright install-deps
49
+
50
  # Configure in mcp_servers_config.json:
51
  {
52
  "mcpServers": {
 
62
  ```bash
63
  # Install MCP service
64
  pip install mcp-server-fetch
65
+
66
  # Configure in mcp_servers_config.json:
67
  {
68
  "mcpServers": {
 
105
  from utils.enhanced_role_playing import OwlRolePlaying, run_society
106
 
107
 
 
108
  load_dotenv()
109
  set_log_level(level="DEBUG")
110
 
 
162
 
163
  question = (
164
  "I'd like a academic report about Andrew Ng, including his research "
165
+ "direction, published papers (At least 3), institutions, etc."
166
  "Then organize the report in Markdown format and save it to my desktop"
167
  )
168
 
 
176
  # Make sure to disconnect safely after all operations are completed.
177
  try:
178
  await mcp_toolkit.disconnect()
179
+ except Exception:
180
+ print("Disconnect failed")
181
+
182
 
183
  if __name__ == "__main__":
184
+ asyncio.run(main())
owl/run_terminal.py CHANGED
@@ -18,7 +18,7 @@ from camel.toolkits import (
18
  SearchToolkit,
19
  BrowserToolkit,
20
  FileWriteToolkit,
21
- TerminalToolkit
22
  )
23
  from camel.types import ModelPlatformType, ModelType
24
  from camel.logger import set_log_level
@@ -30,6 +30,7 @@ set_log_level(level="DEBUG")
30
  # Get current script directory
31
  base_dir = os.path.dirname(os.path.abspath(__file__))
32
 
 
33
  def construct_society(question: str) -> OwlRolePlaying:
34
  r"""Construct a society of agents based on the given question.
35
 
@@ -113,7 +114,9 @@ def main():
113
  answer, chat_history, token_count = run_society(society)
114
 
115
  # Output the result
116
- print(f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m")
 
 
117
 
118
 
119
  if __name__ == "__main__":
 
18
  SearchToolkit,
19
  BrowserToolkit,
20
  FileWriteToolkit,
21
+ TerminalToolkit,
22
  )
23
  from camel.types import ModelPlatformType, ModelType
24
  from camel.logger import set_log_level
 
30
  # Get current script directory
31
  base_dir = os.path.dirname(os.path.abspath(__file__))
32
 
33
+
34
  def construct_society(question: str) -> OwlRolePlaying:
35
  r"""Construct a society of agents based on the given question.
36
 
 
114
  answer, chat_history, token_count = run_society(society)
115
 
116
  # Output the result
117
+ print(
118
+ f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m"
119
+ )
120
 
121
 
122
  if __name__ == "__main__":
owl/run_terminal_zh.py CHANGED
@@ -12,13 +12,13 @@
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  from dotenv import load_dotenv
15
-
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
  BrowserToolkit,
20
  FileWriteToolkit,
21
- TerminalToolkit
22
  )
23
  from camel.types import ModelPlatformType, ModelType
24
  from camel.logger import set_log_level
@@ -27,10 +27,12 @@ from utils import OwlRolePlaying, run_society
27
 
28
  load_dotenv()
29
  set_log_level(level="DEBUG")
30
- import os
 
31
  # Get current script directory
32
  base_dir = os.path.dirname(os.path.abspath(__file__))
33
 
 
34
  def construct_society(question: str) -> OwlRolePlaying:
35
  r"""Construct a society of agents based on the given question.
36
 
@@ -112,7 +114,9 @@ def main():
112
  answer, chat_history, token_count = run_society(society)
113
 
114
  # Output the result
115
- print(f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m")
 
 
116
 
117
 
118
  if __name__ == "__main__":
 
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
  from dotenv import load_dotenv
15
+ import os
16
  from camel.models import ModelFactory
17
  from camel.toolkits import (
18
  SearchToolkit,
19
  BrowserToolkit,
20
  FileWriteToolkit,
21
+ TerminalToolkit,
22
  )
23
  from camel.types import ModelPlatformType, ModelType
24
  from camel.logger import set_log_level
 
27
 
28
  load_dotenv()
29
  set_log_level(level="DEBUG")
30
+
31
+
32
  # Get current script directory
33
  base_dir = os.path.dirname(os.path.abspath(__file__))
34
 
35
+
36
  def construct_society(question: str) -> OwlRolePlaying:
37
  r"""Construct a society of agents based on the given question.
38
 
 
114
  answer, chat_history, token_count = run_society(society)
115
 
116
  # Output the result
117
+ print(
118
+ f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m"
119
+ )
120
 
121
 
122
  if __name__ == "__main__":
owl/utils/enhanced_role_playing.py CHANGED
@@ -282,8 +282,7 @@ Please note that our overall task may be very complicated. Here are some tips th
282
  )
283
 
284
  async def astep(
285
- self,
286
- assistant_msg: BaseMessage
287
  ) -> Tuple[ChatAgentResponse, ChatAgentResponse]:
288
  user_response = await self.user_agent.astep(assistant_msg)
289
  if user_response.terminated or user_response.msgs is None:
@@ -452,9 +451,9 @@ async def run_society(
452
  input_msg = society.init_chat(init_prompt)
453
  for _round in range(round_limit):
454
  assistant_response, user_response = await society.astep(input_msg)
455
- overall_prompt_token_count += (
456
- assistant_response.info["usage"]["completion_tokens"]
457
- )
458
  overall_prompt_token_count += (
459
  assistant_response.info["usage"]["prompt_tokens"]
460
  + user_response.info["usage"]["prompt_tokens"]
 
282
  )
283
 
284
  async def astep(
285
+ self, assistant_msg: BaseMessage
 
286
  ) -> Tuple[ChatAgentResponse, ChatAgentResponse]:
287
  user_response = await self.user_agent.astep(assistant_msg)
288
  if user_response.terminated or user_response.msgs is None:
 
451
  input_msg = society.init_chat(init_prompt)
452
  for _round in range(round_limit):
453
  assistant_response, user_response = await society.astep(input_msg)
454
+ overall_prompt_token_count += assistant_response.info["usage"][
455
+ "completion_tokens"
456
+ ]
457
  overall_prompt_token_count += (
458
  assistant_response.info["usage"]["prompt_tokens"]
459
  + user_response.info["usage"]["prompt_tokens"]
owl/utils/gaia.py CHANGED
@@ -191,7 +191,9 @@ class GAIABenchmark(BaseBenchmark):
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"):
 
191
  except Exception as e:
192
  logger.warning(e)
193
  # raise FileNotFoundError(f"{self.save_to} does not exist.")
194
+ datas = [
195
+ data for data in datas if not self._check_task_completed(data["task_id"])
196
+ ]
197
  logger.info(f"Number of tasks to be processed: {len(datas)}")
198
  # Process tasks
199
  for task in tqdm(datas, desc="Running"):
run_app.py CHANGED
@@ -22,7 +22,8 @@ import os
22
  import sys
23
  from pathlib import Path
24
 
25
- os.environ['PYTHONIOENCODING'] = 'utf-8'
 
26
 
27
  def main():
28
  """Main function to launch the OWL Intelligent Assistant Platform"""
 
22
  import sys
23
  from pathlib import Path
24
 
25
+ os.environ["PYTHONIOENCODING"] = "utf-8"
26
+
27
 
28
  def main():
29
  """Main function to launch the OWL Intelligent Assistant Platform"""
run_app_zh.py CHANGED
@@ -22,7 +22,8 @@ import os
22
  import sys
23
  from pathlib import Path
24
 
25
- os.environ['PYTHONIOENCODING'] = 'utf-8'
 
26
 
27
  def main():
28
  """主函数,启动OWL智能助手运行平台"""
 
22
  import sys
23
  from pathlib import Path
24
 
25
+ os.environ["PYTHONIOENCODING"] = "utf-8"
26
+
27
 
28
  def main():
29
  """主函数,启动OWL智能助手运行平台"""