From 22361b31847dfe20b534c6b899a78d265868bf87 Mon Sep 17 00:00:00 2001 From: lazychih114 <55657767+Aaron617@users.noreply.github.com> Date: Sat, 8 Mar 2025 23:52:52 +0800 Subject: [PATCH 1/9] remove * --- owl/run.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/owl/run.py b/owl/run.py index 9455c1a..6aea767 100644 --- a/owl/run.py +++ b/owl/run.py @@ -2,7 +2,16 @@ from dotenv import load_dotenv load_dotenv() from camel.models import ModelFactory -from camel.toolkits import * +from camel.toolkits import ( + WebToolkit, + DocumentProcessingToolkit, + VideoAnalysisToolkit, + AudioAnalysisToolkit, + CodeExecutionToolkit, + ImageAnalysisToolkit, + SearchToolkit, + ExcelToolkit + ) from camel.types import ModelPlatformType, ModelType from camel.configs import ChatGPTConfig From 9723cb799b34170c1e6781ce3520c25fb1352f37 Mon Sep 17 00:00:00 2001 From: lazychih114 <55657767+Aaron617@users.noreply.github.com> Date: Sun, 9 Mar 2025 00:33:45 +0800 Subject: [PATCH 2/9] Create run_mini.py --- owl/run_mini.py | 96 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 owl/run_mini.py diff --git a/owl/run_mini.py b/owl/run_mini.py new file mode 100644 index 0000000..5045682 --- /dev/null +++ b/owl/run_mini.py @@ -0,0 +1,96 @@ +from dotenv import load_dotenv +load_dotenv() + +from camel.models import ModelFactory +from camel.toolkits import ( + WebToolkit, + DocumentProcessingToolkit, + VideoAnalysisToolkit, + AudioAnalysisToolkit, + CodeExecutionToolkit, + ImageAnalysisToolkit, + SearchToolkit, + ExcelToolkit, + FunctionTool + ) +from camel.types import ModelPlatformType, ModelType +from camel.configs import ChatGPTConfig + +from typing import List, Dict + +from retry import retry +from loguru import logger + +from utils import OwlRolePlaying, run_society +import os + + + + +def construct_society(question: str) -> OwlRolePlaying: + r"""Construct the society based on the question.""" + + user_role_name = "user" + assistant_role_name = "assistant" + + user_model = ModelFactory.create( + model_platform=ModelPlatformType.OPENAI, + model_type=ModelType.GPT_4O, + model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model + ) + + assistant_model = ModelFactory.create( + model_platform=ModelPlatformType.OPENAI, + model_type=ModelType.GPT_4O, + model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model + ) + + tools_list = [ + *WebToolkit( + headless=False, + web_agent_model=assistant_model, + planning_agent_model=assistant_model + ).get_tools(), + # *DocumentProcessingToolkit().get_tools(), + # *VideoAnalysisToolkit(model=assistant_model).get_tools(), # This requires OpenAI Key + # *AudioAnalysisToolkit().get_tools(), # This requires OpenAI Key + # *CodeExecutionToolkit().get_tools(), + # *ImageAnalysisToolkit(model=assistant_model).get_tools(), + FunctionTool(SearchToolkit(model=assistant_model).search_duckduckgo), + # *ExcelToolkit().get_tools() + ] + + user_role_name = 'user' + user_agent_kwargs = dict(model=user_model) + assistant_role_name = 'assistant' + assistant_agent_kwargs = dict(model=assistant_model, + tools=tools_list) + + task_kwargs = { + 'task_prompt': question, + 'with_task_specify': False, + } + + society = OwlRolePlaying( + **task_kwargs, + user_role_name=user_role_name, + user_agent_kwargs=user_agent_kwargs, + assistant_role_name=assistant_role_name, + assistant_agent_kwargs=assistant_agent_kwargs, + ) + + return society + + +# Example case +question = "What was the volume in m^3 of the fish bag that was calculated in the University of Leicester paper `Can Hiccup Supply Enough Fish to Maintain a Dragon’s Diet?` " + +society = construct_society(question) +answer, chat_history, token_count = run_society(society) + +logger.success(f"Answer: {answer}") + + + + + From b0d6d27d53e9d6fddc61ae8f7856ff29538da7c9 Mon Sep 17 00:00:00 2001 From: lazychih114 <55657767+Aaron617@users.noreply.github.com> Date: Sun, 9 Mar 2025 00:38:27 +0800 Subject: [PATCH 3/9] update readme --- README.md | 14 ++++++++++++-- README_zh.md | 10 ++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5ef257e..eaf87a1 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,10 @@ playwright install In the `owl/.env_example` file, you will find all the necessary API keys along with the websites where you can register for each service. To use these API services, follow these steps: 1. *Copy and Rename*: Duplicate the `.env_example` file and rename the copy to `.env`. -2. *Fill in Your Keys*: Open the `.env` file and insert your API keys in the corresponding fields. +```bash +cp owl/.env_template .env +``` +2. *Fill in Your Keys*: Open the `.env` file and insert your API keys in the corresponding fields. (For the minimal example (`run_mini.py`), you only need to configure the LLM API key (e.g., OPENAI_API_KEY).) 3. *For using more other models*: please refer to our CAMEL models docs:https://docs.camel-ai.org/key_modules/models.html#supported-model-platforms-in-camel @@ -137,11 +140,18 @@ In the `owl/.env_example` file, you will find all the necessary API keys along w # 🚀 Quick Start -Run the following minimal example: +Run the following demo case: ```bash python owl/run.py ``` + +For a simpler version that only requires an LLM API key, you can try our minimal example: + +```bash +python owl/run_mini.py +``` + You can run OWL agent with your own task by modifying the `run.py` script: ```python diff --git a/README_zh.md b/README_zh.md index 76dffae..cbb5ff2 100644 --- a/README_zh.md +++ b/README_zh.md @@ -133,13 +133,19 @@ python -m pip install -r requirements.txt # 🚀 快速开始 -运行以下最小示例: +运行以下示例: ```bash python owl/run.py ``` -你可以通过修改 `run.py` 来运行自定义任务的 OWL 智能体: +我们还提供了一个最小化示例,只需配置LLM的API密钥即可运行: + +```bash +python owl/run_mini.py +``` + +你可以通过修改 `run.py` 脚本来运行自己的任务: ```python # Define your own task From 47189e14ff9e37c65e56e184840ff76c14658bb2 Mon Sep 17 00:00:00 2001 From: "yifeng.wang" <3038880699@qq.com> Date: Sun, 9 Mar 2025 02:03:24 +0800 Subject: [PATCH 4/9] fix modelfile --- owl/{run_qwq_demo.py => run_openai_compatiable_model.py} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename owl/{run_qwq_demo.py => run_openai_compatiable_model.py} (91%) diff --git a/owl/run_qwq_demo.py b/owl/run_openai_compatiable_model.py similarity index 91% rename from owl/run_qwq_demo.py rename to owl/run_openai_compatiable_model.py index 8efa9ad..c0ec572 100644 --- a/owl/run_qwq_demo.py +++ b/owl/run_openai_compatiable_model.py @@ -26,7 +26,7 @@ def construct_society(question: str) -> OwlRolePlaying: user_model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL, - model_type="qwq-32b", + model_type="qwen-max", api_key=os.getenv("QWEN_API_KEY"), url="https://dashscope.aliyuncs.com/compatible-mode/v1", model_config_dict={"temperature": 0.4, "max_tokens": 4096}, @@ -34,7 +34,7 @@ def construct_society(question: str) -> OwlRolePlaying: assistant_model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI_COMPATIBLE_MODEL, - model_type="qwq-32b", + model_type="qwen-max", api_key=os.getenv("QWEN_API_KEY"), url="https://dashscope.aliyuncs.com/compatible-mode/v1", model_config_dict={"temperature": 0.4, "max_tokens": 4096}, @@ -79,7 +79,7 @@ def construct_society(question: str) -> OwlRolePlaying: # Example case -question = "What was the volume in m^3 of the fish bag that was calculated in the University of Leicester paper `Can Hiccup Supply Enough Fish to Maintain a Dragon’s Diet?` " +question = "what is the weather in beijing today?" society = construct_society(question) answer, chat_history, token_count = run_society(society) From 63a14115b0c9bf0f99e2c852f73061a0e4f49089 Mon Sep 17 00:00:00 2001 From: Wendong Date: Sun, 9 Mar 2025 03:03:46 +0800 Subject: [PATCH 5/9] move docker related files under .container --- .dockerignore => .container/.dockerignore | 0 DOCKER_README.md => .container/DOCKER_README.md | 0 Dockerfile => .container/Dockerfile | 0 build_docker.bat => .container/build_docker.bat | 0 build_docker.sh => .container/build_docker.sh | 0 check_docker.bat => .container/check_docker.bat | 0 check_docker.sh => .container/check_docker.sh | 0 docker-compose.yml => .container/docker-compose.yml | 0 run_in_docker.bat => .container/run_in_docker.bat | 0 run_in_docker.sh => .container/run_in_docker.sh | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename .dockerignore => .container/.dockerignore (100%) rename DOCKER_README.md => .container/DOCKER_README.md (100%) rename Dockerfile => .container/Dockerfile (100%) rename build_docker.bat => .container/build_docker.bat (100%) rename build_docker.sh => .container/build_docker.sh (100%) rename check_docker.bat => .container/check_docker.bat (100%) rename check_docker.sh => .container/check_docker.sh (100%) rename docker-compose.yml => .container/docker-compose.yml (100%) rename run_in_docker.bat => .container/run_in_docker.bat (100%) rename run_in_docker.sh => .container/run_in_docker.sh (100%) diff --git a/.dockerignore b/.container/.dockerignore similarity index 100% rename from .dockerignore rename to .container/.dockerignore diff --git a/DOCKER_README.md b/.container/DOCKER_README.md similarity index 100% rename from DOCKER_README.md rename to .container/DOCKER_README.md diff --git a/Dockerfile b/.container/Dockerfile similarity index 100% rename from Dockerfile rename to .container/Dockerfile diff --git a/build_docker.bat b/.container/build_docker.bat similarity index 100% rename from build_docker.bat rename to .container/build_docker.bat diff --git a/build_docker.sh b/.container/build_docker.sh similarity index 100% rename from build_docker.sh rename to .container/build_docker.sh diff --git a/check_docker.bat b/.container/check_docker.bat similarity index 100% rename from check_docker.bat rename to .container/check_docker.bat diff --git a/check_docker.sh b/.container/check_docker.sh similarity index 100% rename from check_docker.sh rename to .container/check_docker.sh diff --git a/docker-compose.yml b/.container/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to .container/docker-compose.yml diff --git a/run_in_docker.bat b/.container/run_in_docker.bat similarity index 100% rename from run_in_docker.bat rename to .container/run_in_docker.bat diff --git a/run_in_docker.sh b/.container/run_in_docker.sh similarity index 100% rename from run_in_docker.sh rename to .container/run_in_docker.sh From 671db3324ea3085afa3c21cbecf088383e0fc2f5 Mon Sep 17 00:00:00 2001 From: lazychih114 <55657767+Aaron617@users.noreply.github.com> Date: Sun, 9 Mar 2025 12:59:36 +0800 Subject: [PATCH 6/9] clean code --- owl/run.py | 9 +++------ owl/run_deepseek_example.py | 3 --- owl/run_gaia_roleplaying.py | 2 -- owl/run_mini.py | 19 ------------------- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/owl/run.py b/owl/run.py index 6aea767..cf30504 100644 --- a/owl/run.py +++ b/owl/run.py @@ -13,15 +13,12 @@ from camel.toolkits import ( ExcelToolkit ) from camel.types import ModelPlatformType, ModelType -from camel.configs import ChatGPTConfig +# from camel.configs import ChatGPTConfig -from typing import List, Dict -from retry import retry from loguru import logger from utils import OwlRolePlaying, run_society -import os @@ -35,13 +32,13 @@ def construct_society(question: str) -> OwlRolePlaying: user_model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI, model_type=ModelType.GPT_4O, - model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model + # model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model ) assistant_model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI, model_type=ModelType.GPT_4O, - model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model + # model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model ) tools_list = [ diff --git a/owl/run_deepseek_example.py b/owl/run_deepseek_example.py index da14d9e..c51e6a0 100644 --- a/owl/run_deepseek_example.py +++ b/owl/run_deepseek_example.py @@ -3,13 +3,10 @@ from camel.toolkits import * from camel.types import ModelPlatformType, ModelType from camel.configs import DeepSeekConfig -from typing import List, Dict from dotenv import load_dotenv -from retry import retry from loguru import logger from utils import OwlRolePlaying, run_society -import os load_dotenv() diff --git a/owl/run_gaia_roleplaying.py b/owl/run_gaia_roleplaying.py index 8464af6..577cfbd 100644 --- a/owl/run_gaia_roleplaying.py +++ b/owl/run_gaia_roleplaying.py @@ -5,11 +5,9 @@ from camel.configs import ChatGPTConfig from utils import GAIABenchmark from dotenv import load_dotenv -from retry import retry from loguru import logger import os -import shutil load_dotenv() diff --git a/owl/run_mini.py b/owl/run_mini.py index 5045682..e00ac88 100644 --- a/owl/run_mini.py +++ b/owl/run_mini.py @@ -4,26 +4,15 @@ load_dotenv() from camel.models import ModelFactory from camel.toolkits import ( WebToolkit, - DocumentProcessingToolkit, - VideoAnalysisToolkit, - AudioAnalysisToolkit, - CodeExecutionToolkit, - ImageAnalysisToolkit, SearchToolkit, - ExcelToolkit, FunctionTool ) from camel.types import ModelPlatformType, ModelType -from camel.configs import ChatGPTConfig -from typing import List, Dict -from retry import retry from loguru import logger from utils import OwlRolePlaying, run_society -import os - @@ -36,13 +25,11 @@ def construct_society(question: str) -> OwlRolePlaying: user_model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI, model_type=ModelType.GPT_4O, - model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model ) assistant_model = ModelFactory.create( model_platform=ModelPlatformType.OPENAI, model_type=ModelType.GPT_4O, - model_config_dict=ChatGPTConfig(temperature=0, top_p=1).as_dict(), # [Optional] the config for model ) tools_list = [ @@ -51,13 +38,7 @@ def construct_society(question: str) -> OwlRolePlaying: web_agent_model=assistant_model, planning_agent_model=assistant_model ).get_tools(), - # *DocumentProcessingToolkit().get_tools(), - # *VideoAnalysisToolkit(model=assistant_model).get_tools(), # This requires OpenAI Key - # *AudioAnalysisToolkit().get_tools(), # This requires OpenAI Key - # *CodeExecutionToolkit().get_tools(), - # *ImageAnalysisToolkit(model=assistant_model).get_tools(), FunctionTool(SearchToolkit(model=assistant_model).search_duckduckgo), - # *ExcelToolkit().get_tools() ] user_role_name = 'user' From 544ddb546bb5d0c03ac5d0075008c5bde0399972 Mon Sep 17 00:00:00 2001 From: Yuhang Zhou <86864241+Ralph-Zhou@users.noreply.github.com> Date: Sun, 9 Mar 2025 13:01:29 +0800 Subject: [PATCH 7/9] Update README.md --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d8bb9d..2d7a4c3 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ Our vision is to revolutionize how AI agents collaborate to solve real-world tas - [📋 Table of Contents](#-table-of-contents) - [🔥 News](#-news) - [🎬 Demo Video](#-demo-video) -- [✨️ Core Features](#-code-features) +- [✨️ Core Features](#-core-features) - [🛠️ Installation](#️-installation) - [**Clone the Github repository**](#clone-the-github-repository) - [**Set up Environment**](#set-up-environment) @@ -172,6 +172,21 @@ answer, chat_history, token_count = run_society(society) logger.success(f"Answer: {answer}") ``` +For uploading files, simply provide the file path along with your question: + +```python +# Task with a local file (e.g., file path: `tmp/example.docx`) +question = "What is in the given DOCX file? Here is the file path: tmp/example.docx" + +society = construct_society(question) +answer, chat_history, token_count = run_society(society) + +logger.success(f"Answer: {answer}") +``` + +OWL will then automatically invoke document-related tools to process the file and extract the answer. + + Example tasks you can try: - "Find the latest stock price for Apple Inc." - "Analyze the sentiment of recent tweets about climate change" From 2edcf9dc283e65f9bb571ac151893fc4be57d99f Mon Sep 17 00:00:00 2001 From: Yuhang Zhou <86864241+Ralph-Zhou@users.noreply.github.com> Date: Sun, 9 Mar 2025 13:04:23 +0800 Subject: [PATCH 8/9] Update README_zh.md --- README_zh.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README_zh.md b/README_zh.md index ee1af7f..308a351 100644 --- a/README_zh.md +++ b/README_zh.md @@ -166,6 +166,19 @@ answer, chat_history, token_count = run_society(society) logger.success(f"Answer: {answer}") ``` +上传文件时,只需在问题中额外提供文件路径: + +```python +# 处理本地文件(例如,文件路径为 `tmp/example.docx`) +question = "给定的 DOCX 文件中有什么内容?文件路径如下:tmp/example.docx" + +society = construct_society(question) +answer, chat_history, token_count = run_society(society) + +logger.success(f"答案:{answer}") +``` +OWL 将自动调用与文档相关的工具来处理文件并提取答案。 + 你可以尝试以下示例任务: - "查询苹果公司的最新股票价格" - "分析关于气候变化的最新推文情绪" From 8da5a9493fd712194ff7669dd2f04cacb64cbb03 Mon Sep 17 00:00:00 2001 From: Yuhang Zhou <86864241+Ralph-Zhou@users.noreply.github.com> Date: Sun, 9 Mar 2025 13:08:11 +0800 Subject: [PATCH 9/9] Update README_zh.md --- README_zh.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README_zh.md b/README_zh.md index ee1af7f..6a2adea 100644 --- a/README_zh.md +++ b/README_zh.md @@ -166,6 +166,21 @@ answer, chat_history, token_count = run_society(society) logger.success(f"Answer: {answer}") ``` +上传文件时,只需提供文件路径和问题: + +```python +# 处理本地文件(例如,文件路径为 `tmp/example.docx`) +question = "给定的 DOCX 文件中有什么内容?文件路径如下:tmp/example.docx" + +society = construct_society(question) +answer, chat_history, token_count = run_society(society) + +logger.success(f"答案:{answer}") +``` + +OWL 将自动调用与文档相关的工具来处理文件并提取答案。 + + 你可以尝试以下示例任务: - "查询苹果公司的最新股票价格" - "分析关于气候变化的最新推文情绪"