update readme and format fix

This commit is contained in:
Wendong
2025-03-13 22:33:21 +08:00
parent 7f5d356947
commit b44d5b9604
10 changed files with 101 additions and 28 deletions

View File

@@ -122,7 +122,9 @@ https://private-user-images.githubusercontent.com/55657767/420212194-e813fc05-13
- **Browser Automation**: Utilize the Playwright framework for simulating browser interactions, including scrolling, clicking, input handling, downloading, navigation, and more.
- **Document Parsing**: Extract content from Word, Excel, PDF, and PowerPoint files, converting them into text or Markdown format.
- **Code Execution**: Write and execute Python code using interpreter.
- **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.
- **Built-in Toolkits**: Access to a comprehensive set of built-in toolkits including:
- **Model Context Protocol (MCP)**: A universal protocol layer that standardizes AI model interactions with various tools and data sources
- **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
# 🛠️ Installation
@@ -275,6 +277,23 @@ For more detailed Docker usage instructions, including cross-platform support, o
# 🚀 Quick Start
## Try MCP (Model Context Protocol) Integration
Experience the power of MCP by running our example that demonstrates multi-agent information retrieval and processing:
```bash
# Set up MCP servers (one-time setup)
npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
npx @wonderwhy-er/desktop-commander setup
# Run the MCP example
python owl/run_mcp.py
```
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.
## Basic Usage
After installation and setting up your environment variables, you can start using OWL right away:
```bash
@@ -355,6 +374,14 @@ Here are some tasks you can try with OWL:
# 🧰 Toolkits and Capabilities
## Model Context Protocol (MCP)
OWL's MCP integration provides a standardized way for AI models to interact with various tools and data sources:
Try our comprehensive MCP example in `owl/run_mcp.py` to see these capabilities in action!
## Available Toolkits
> **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.
OWL supports various toolkits that can be customized by modifying the `tools` list in your script:

View File

@@ -105,7 +105,7 @@
</div>
- **[2025.03.12]**: 在SearchToolkit中添加了Bocha搜索功能集成了火山引擎模型平台并更新了Azure和OpenAI Compatible模型的结构化输出和工具调用能力。
- **[2025.03.11]**: 我们添加了 MCPToolkit、FileWriteToolkit 和 TerminalToolkit增强 OWL Agent的工具调用、文件写入能力和终端命令执行功能
- **[2025.03.11]**: 我们添加了 MCPToolkit、FileWriteToolkit 和 TerminalToolkit增强 OWL Agent 的 MCP模型上下文协议集成、文件写入能力和终端命令执行功能。MCP 作为一个通用协议层,标准化了 AI 模型与各种数据源和工具的交互方式
- **[2025.03.09]**: 我们添加了基于网页的用户界面,使系统交互变得更加简便。
- **[2025.03.07]**: 我们开源了 🦉 OWL 项目的代码库。
- **[2025.03.03]**: OWL 在 GAIA 基准测试中取得 58.18 平均分,在开源框架中排名第一!
@@ -272,6 +272,23 @@ chmod +x build_docker.sh
更多详细的Docker使用说明包括跨平台支持、优化配置和故障排除请参阅 [DOCKER_README.md](.container/DOCKER_README.md)
# 🚀 快速开始
## 尝试 MCP模型上下文协议集成
体验 MCP 的强大功能,运行我们的示例来展示多智能体信息检索和处理:
```bash
# 设置 MCP 服务器(仅需一次性设置)
npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
npx @wonderwhy-er/desktop-commander setup
# 运行 MCP 示例
python owl/run_mcp.py
```
这个示例展示了 OWL 智能体如何通过 MCP 协议无缝地与文件系统、网页自动化和信息检索进行交互。查看 `owl/run_mcp.py` 了解完整实现。
## 基本用法
运行以下示例:
@@ -349,6 +366,14 @@ OWL 将自动调用与文档相关的工具来处理文件并提取答案。
# 🧰 工具包与功能
## 模型上下文协议MCP
OWL 的 MCP 集成为 AI 模型与各种工具和数据源的交互提供了标准化的方式。
查看我们的综合示例 `owl/run_mcp.py` 来体验这些功能!
## 可用工具包
> **重要提示**有效使用工具包需要具备强大工具调用能力的模型。对于多模态工具包Web、图像、视频模型还必须具备多模态理解能力。
OWL支持多种工具包可通过修改脚本中的`tools`列表进行自定义:

View File

@@ -31,7 +31,7 @@ from camel.toolkits import (
from camel.types import ModelPlatformType, ModelType
from utils import OwlRolePlaying, run_society, DocumentProcessingToolkit
from utils import OwlRolePlaying, run_society
from camel.logger import set_log_level
@@ -99,9 +99,7 @@ def construct_society(question: str) -> OwlRolePlaying:
def main():
r"""Main function to run the OWL system with an example question."""
# Example research question
question = (
"搜索OWL项目最近的新闻并生成一篇报告最后保存到本地。"
)
question = "搜索OWL项目最近的新闻并生成一篇报告最后保存到本地。"
# Construct and run the society
society = construct_society(question)

View File

@@ -1,3 +1,16 @@
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
"""MCP Multi-Agent System Example
This example demonstrates how to use MCP (Model Context Protocol) with CAMEL agents
@@ -15,7 +28,7 @@ Environment Setup:
# Install MCP service
npx -y @smithery/cli install @wonderwhy-er/desktop-commander --client claude
npx @wonderwhy-er/desktop-commander setup
# Configure in owl/mcp_servers_config.json:
{
"desktop-commander": {
@@ -33,7 +46,7 @@ Environment Setup:
# Install MCP service
npm install -g @executeautomation/playwright-mcp-server
npx playwright install-deps
# Configure in mcp_servers_config.json:
{
"mcpServers": {
@@ -49,7 +62,7 @@ Environment Setup:
```bash
# Install MCP service
pip install mcp-server-fetch
# Configure in mcp_servers_config.json:
{
"mcpServers": {
@@ -92,7 +105,6 @@ from camel.toolkits import MCPToolkit
from utils.enhanced_role_playing import OwlRolePlaying, run_society
load_dotenv()
set_log_level(level="DEBUG")
@@ -150,7 +162,7 @@ async def main():
question = (
"I'd like a academic report about Andrew Ng, including his research "
"direction, published papers (At least 3), institutions, etc."
"direction, published papers (At least 3), institutions, etc."
"Then organize the report in Markdown format and save it to my desktop"
)
@@ -164,8 +176,9 @@ async def main():
# Make sure to disconnect safely after all operations are completed.
try:
await mcp_toolkit.disconnect()
except Exception as e:
print(f"Warning: Error during disconnect: {e}")
except Exception:
print("Disconnect failed")
if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())

View File

@@ -18,7 +18,7 @@ from camel.toolkits import (
SearchToolkit,
BrowserToolkit,
FileWriteToolkit,
TerminalToolkit
TerminalToolkit,
)
from camel.types import ModelPlatformType, ModelType
from camel.logger import set_log_level
@@ -30,6 +30,7 @@ set_log_level(level="DEBUG")
# Get current script directory
base_dir = os.path.dirname(os.path.abspath(__file__))
def construct_society(question: str) -> OwlRolePlaying:
r"""Construct a society of agents based on the given question.
@@ -113,7 +114,9 @@ def main():
answer, chat_history, token_count = run_society(society)
# Output the result
print(f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m")
print(
f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m"
)
if __name__ == "__main__":

View File

@@ -12,13 +12,13 @@
# limitations under the License.
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
from dotenv import load_dotenv
import os
from camel.models import ModelFactory
from camel.toolkits import (
SearchToolkit,
BrowserToolkit,
FileWriteToolkit,
TerminalToolkit
TerminalToolkit,
)
from camel.types import ModelPlatformType, ModelType
from camel.logger import set_log_level
@@ -27,10 +27,12 @@ from utils import OwlRolePlaying, run_society
load_dotenv()
set_log_level(level="DEBUG")
import os
# Get current script directory
base_dir = os.path.dirname(os.path.abspath(__file__))
def construct_society(question: str) -> OwlRolePlaying:
r"""Construct a society of agents based on the given question.
@@ -112,7 +114,9 @@ def main():
answer, chat_history, token_count = run_society(society)
# Output the result
print(f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m")
print(
f"\033[94mAnswer: {answer}\nChat History: {chat_history}\ntoken_count:{token_count}\033[0m"
)
if __name__ == "__main__":

View File

@@ -282,8 +282,7 @@ Please note that our overall task may be very complicated. Here are some tips th
)
async def astep(
self,
assistant_msg: BaseMessage
self, assistant_msg: BaseMessage
) -> Tuple[ChatAgentResponse, ChatAgentResponse]:
user_response = await self.user_agent.astep(assistant_msg)
if user_response.terminated or user_response.msgs is None:
@@ -452,9 +451,9 @@ async def run_society(
input_msg = society.init_chat(init_prompt)
for _round in range(round_limit):
assistant_response, user_response = await society.astep(input_msg)
overall_prompt_token_count += (
assistant_response.info["usage"]["completion_tokens"]
)
overall_prompt_token_count += assistant_response.info["usage"][
"completion_tokens"
]
overall_prompt_token_count += (
assistant_response.info["usage"]["prompt_tokens"]
+ user_response.info["usage"]["prompt_tokens"]

View File

@@ -191,7 +191,9 @@ class GAIABenchmark(BaseBenchmark):
except Exception as e:
logger.warning(e)
# raise FileNotFoundError(f"{self.save_to} does not exist.")
datas = [data for data in datas if not self._check_task_completed(data["task_id"])]
datas = [
data for data in datas if not self._check_task_completed(data["task_id"])
]
logger.info(f"Number of tasks to be processed: {len(datas)}")
# Process tasks
for task in tqdm(datas, desc="Running"):

View File

@@ -22,7 +22,8 @@ import os
import sys
from pathlib import Path
os.environ['PYTHONIOENCODING'] = 'utf-8'
os.environ["PYTHONIOENCODING"] = "utf-8"
def main():
"""Main function to launch the OWL Intelligent Assistant Platform"""

View File

@@ -22,7 +22,8 @@ import os
import sys
from pathlib import Path
os.environ['PYTHONIOENCODING'] = 'utf-8'
os.environ["PYTHONIOENCODING"] = "utf-8"
def main():
"""主函数启动OWL智能助手运行平台"""