🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: enhance new feature implementation (#1826)
Wendong-Fan2d2a295e5a5e
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 251692817..d5cd3465a 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -26,7 +26,7 @@ body:attributes:label: What version of camel are you using?description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.- placeholder: E.g., 0.2.26+ placeholder: E.g., 0.2.27validations:required: truediff --git a/.github/workflows/build_package.yml b/.github/workflows/build_package.ymlindex 4c87f3e74..145efab2a 100644--- a/.github/workflows/build_package.yml+++ b/.github/workflows/build_package.yml@@ -97,6 +97,7 @@ jobs:MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"AIML_API_KEY: "${{ secrets.AIML_API_KEY }}"NVIDIA_API_KEY: "${{ secrets.NVIDIA_API_KEY }}"+ VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"run: |source test_venv/bin/activatepytest --fast-test-mode ./testdiff --git a/.github/workflows/pytest_package.yml b/.github/workflows/pytest_package.ymlindex cbf139b00..27808290c 100644--- a/.github/workflows/pytest_package.yml+++ b/.github/workflows/pytest_package.yml@@ -62,6 +62,7 @@ jobs:MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"AIML_API_KEY: "${{ secrets.AIML_API_KEY }}"+ VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"run: |source .venv/bin/activateuv pip install -e ".[all, dev, docs]"@@ -116,6 +117,7 @@ jobs:MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"AIML_API_KEY: "${{ secrets.AIML_API_KEY }}"+ VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"run: |source .venv/bin/activateuv pip install -e ".[all, dev, docs]"@@ -168,6 +170,7 @@ jobs:INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"JINA_API_KEY: "${{ secrets.JINA_API_KEY }}"MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"+ VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"run: |source .venv/bin/activateuv pip install -e ".[all, dev, docs]"diff --git a/camel/__init__.py b/camel/__init__.pyindex c4ba66711..81c7d37d2 100644--- a/camel/__init__.py+++ b/camel/__init__.py@@ -14,7 +14,7 @@from camel.logger import disable_logging, enable_logging, set_log_level-__version__ = '0.2.26'+__version__ = '0.2.27'__all__ = ['__version__',diff --git a/camel/models/volcano_model.py b/camel/models/volcano_model.pyindex 9f9bda693..8b3c2e2ff 100644--- a/camel/models/volcano_model.py+++ b/camel/models/volcano_model.py@@ -13,14 +13,11 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========import os-from typing import Any, Dict, List, Optional, Type, Union--from pydantic import BaseModel+from typing import Any, Dict, Optional, Unionfrom camel.configs import OPENAI_API_PARAMS-from camel.messages import OpenAIMessagefrom camel.models.openai_compatible_model import OpenAICompatibleModel-from camel.types import ChatCompletion, ModelType+from camel.types import ModelTypefrom camel.utils import (BaseTokenCounter,OpenAITokenCounter,@@ -61,14 +58,14 @@ class VolcanoModel(OpenAICompatibleModel):) -> None:if model_config_dict is None:model_config_dict = {}-+api_key = api_key or os.environ.get("VOLCANO_API_KEY")url = (urlor os.environ.get("VOLCANO_API_BASE_URL")or "https://ark.cn-beijing.volces.com/api/v3")-+super().__init__(model_type, model_config_dict, api_key, url, token_counter)@@ -100,4 +97,4 @@ class VolcanoModel(OpenAICompatibleModel):raise ValueError(f"Unexpected argument `{param}` is ""input into Volcano model backend."- )\ No newline at end of file+ )diff --git a/camel/toolkits/__init__.py b/camel/toolkits/__init__.pyindex c892954d5..11be755a2 100644--- a/camel/toolkits/__init__.py+++ b/camel/toolkits/__init__.py@@ -55,7 +55,7 @@ from .excel_toolkit import ExcelToolkitfrom .video_analysis_toolkit import VideoAnalysisToolkitfrom .image_analysis_toolkit import ImageAnalysisToolkitfrom .mcp_toolkit import MCPToolkit-from .web_toolkit import WebToolkit+from .browser_toolkit import BrowserToolkitfrom .file_write_toolkit import FileWriteToolkitfrom .terminal_toolkit import TerminalToolkitfrom .pubmed_toolkit import PubMedToolkit@@ -102,7 +102,7 @@ __all__ = ['ExcelToolkit','VideoAnalysisToolkit','ImageAnalysisToolkit',- 'WebToolkit',+ 'BrowserToolkit','FileWriteToolkit','TerminalToolkit','PubMedToolkit',diff --git a/camel/toolkits/web_toolkit.py b/camel/toolkits/browser_toolkit.pysimilarity index 99%rename from camel/toolkits/web_toolkit.pyrename to camel/toolkits/browser_toolkit.pyindex 95762b5b1..54dd0db2f 100644--- a/camel/toolkits/web_toolkit.py+++ b/camel/toolkits/browser_toolkit.py@@ -915,7 +915,7 @@ class BaseBrowser:return markdown_content-class WebToolkit(BaseToolkit):+class BrowserToolkit(BaseToolkit):r"""A class for browsing the web and interacting with web pages.This class provides methods for browsing the web and interacting with web@@ -931,7 +931,7 @@ class WebToolkit(BaseToolkit):planning_agent_model: Optional[BaseModelBackend] = None,output_language: str = "en",):- r"""Initialize the WebToolkit instance.+ r"""Initialize the BrowserToolkit instance.Args:headless (bool): Whether to run the browser in headless mode.@@ -1289,7 +1289,7 @@ Your output should be in json format, including the following fields:return False, replanned_schema@dependencies_required("playwright")- def browser_simulation(+ def browse_url(self, task_prompt: str, start_url: str, round_limit: int = 12) -> str:r"""A powerful toolkit which can simulate the browser interaction to solve the task which needs multi-step actions.@@ -1370,4 +1370,4 @@ Your output should be in json format, including the following fields:return simulation_resultdef get_tools(self) -> List[FunctionTool]:- return [FunctionTool(self.browser_simulation)]+ return [FunctionTool(self.browse_url)]diff --git a/camel/toolkits/search_toolkit.py b/camel/toolkits/search_toolkit.pyindex 968f74dcf..389d32cce 100644--- a/camel/toolkits/search_toolkit.py+++ b/camel/toolkits/search_toolkit.py@@ -731,8 +731,8 @@ class SearchToolkit(BaseToolkit):Returns:Dict[str, Any]: A dictionary containing search results, including- web pages, images, and videos if available. The structure follows- the Bocha AI search API response format.+ web pages, images, and videos if available. The structure+ follows the Bocha AI search API response format."""import jsondiff --git a/camel/types/enums.py b/camel/types/enums.pyindex bbf6051cc..27c9784d3 100644--- a/camel/types/enums.py+++ b/camel/types/enums.py@@ -249,6 +249,7 @@ class ModelType(UnifiedModelType, Enum):self.is_siliconflow,self.is_zhipuai,self.is_aiml,+ self.is_azure_openai,])diff --git a/docs/conf.py b/docs/conf.pyindex 91d6336d9..d47e10e86 100644--- a/docs/conf.py+++ b/docs/conf.py@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('..'))project = 'CAMEL'copyright = '2024, CAMEL-AI.org'author = 'CAMEL-AI.org'-release = '0.2.26'+release = '0.2.27'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/docs/key_modules/loaders.md b/docs/key_modules/loaders.mdindex 09fff1f7d..1b301a37b 100644--- a/docs/key_modules/loaders.md+++ b/docs/key_modules/loaders.md@@ -340,14 +340,14 @@ response = jina_reader.read_content("https://docs.camel-ai.org/")print(response)``````markdown->>>Welcome to CAMEL’s documentation! — CAMEL 0.2.26 documentation+>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.27 documentation===============[Skip to main content](https://docs.camel-ai.org/#main-content)Back to top Ctrl+K- [ CAMEL 0.2.26](https://docs.camel-ai.org/#)+ [ CAMEL 0.2.27](https://docs.camel-ai.org/#)Search Ctrl+Kdiff --git a/docs/key_modules/tools.md b/docs/key_modules/tools.mdindex c7233757b..113103b75 100644--- a/docs/key_modules/tools.md+++ b/docs/key_modules/tools.md@@ -183,7 +183,7 @@ CAMEL provides a variety of built-in toolkits that you can use right away. Here'| VideoAnalysisToolkit | A toolkit for analyzing video content with vision-language models, including frame extraction and question answering about video content. || VideoDownloaderToolkit | A toolkit for downloading videos and optionally splitting them into chunks, with support for various video services. || WeatherToolkit | A toolkit for fetching weather data for cities using the OpenWeatherMap API. |-| WebToolkit | A toolkit for browsing the web and interacting with web pages, including browser simulation and content extraction. |+| BrowserToolkit | A toolkit for browsing the web and interacting with web pages, including browser simulation and content extraction. || WhatsAppToolkit | A toolkit for interacting with the WhatsApp Business API, including sending messages, managing message templates, and accessing business profile information. || ZapierToolkit | A toolkit for interacting with Zapier's NLA API to execute actions through natural language commands and automate workflows. |diff --git a/examples/models/role_playing_with_volcano.py b/examples/models/role_playing_with_volcano.pyindex 127486235..8fa16b058 100644--- a/examples/models/role_playing_with_volcano.py+++ b/examples/models/role_playing_with_volcano.py@@ -12,12 +12,10 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========-import osfrom typing import Dict, List, Optional, Tuple-from camel.societies import RolePlaying-from camel.configs import ChatGPTConfigfrom camel.models import ModelFactory+from camel.societies import RolePlayingfrom camel.types import ModelPlatformTypefrom camel.utils import print_text_animated@@ -41,7 +39,7 @@ def main(with_task_specify: bool = True,model_config_dict: Optional[Dict] = None,) -> Tuple[List[Dict], List[Dict]]:- """Run a role-playing session with Volcano Engine API.+ r"""Run a role-playing session with Volcano Engine API.Args:assistant_role_name: The role name of the assistant.@@ -54,18 +52,10 @@ def main(A tuple of assistant and user message lists."""if model_config_dict is None:- model_config_dict = ChatGPTConfig(- temperature=0.2,- max_tokens=1024,- ).as_dict()-- # Check if VOLCANO_API_KEY is set- api_key = os.environ.get("VOLCANO_API_KEY")- if not api_key:- raise ValueError(- "VOLCANO_API_KEY environment variable is not set. "- "Please set it before running this example."- )+ model_config_dict = {+ "temperature": 0.2,+ "max_tokens": 1024,+ }# Create models for assistant and userassistant_model = ModelFactory.create(@@ -104,7 +94,9 @@ def main(input_msg = role_playing.init_chat() # Initialize the chatwhile n < 10:n += 1- assistant_response, user_response = role_playing.step(input_msg) # Provide input_msg+ assistant_response, user_response = role_playing.step(+ input_msg+ ) # Provide input_msgif assistant_response is None or user_response is None:break@@ -126,10 +118,13 @@ def main(if "<CAMEL_TASK_DONE>" in user_response.msg.content:break- input_msg = assistant_response.msg # Update input_msg for the next step+ input_msg = (+ assistant_response.msg+ ) # Update input_msg for the next step- # return role_playing.assistant_agent.chat_history, role_playing.user_agent.chat_history+ # return role_playing.assistant_agent.chat_history, role_playing.+ # user_agent.chat_historyif __name__ == "__main__":- main()\ No newline at end of file+ main()diff --git a/examples/models/volcano_model_example.py b/examples/models/volcano_model_example.pyindex 5be17b7e1..0a8f3e13a 100644--- a/examples/models/volcano_model_example.py+++ b/examples/models/volcano_model_example.py@@ -44,4 +44,4 @@ user_msg = """How many r in strawberry."""# Get response informationresponse = camel_agent.step(user_msg)-print(response.msgs[0].content)\ No newline at end of file+print(response.msgs[0].content)diff --git a/examples/toolkits/search_toolkit.py b/examples/toolkits/search_toolkit.pyindex 31e803785..8c5dc9fa4 100644--- a/examples/toolkits/search_toolkit.py+++ b/examples/toolkits/search_toolkit.py@@ -78,7 +78,8 @@ usr_msg = "What is the temperature in Tokyo?"response = agent.step(input_message=usr_msg, response_format=None)print(response.msgs[0].content)-'''+"""+===============================================================================The current temperature in Tokyo can be found on various weather websites.Here are a couple of reliable sources where you can check the latest weatherconditions:@@ -88,8 +89,8 @@ conditions:You can visit these links to get the most up-to-date temperature and weatherconditions in Tokyo.-'''-+===============================================================================+"""search_linkup_response = SearchToolkit().search_linkup(query="Can you tell me which women were awared the Physics Nobel Prize",depth="standard",@@ -98,6 +99,7 @@ search_linkup_response = SearchToolkit().search_linkup(print(search_linkup_response)"""+==============================================================================={'results': [{'type': 'text', 'name': 'Physics Nobel Prizes awarded to women |Scientia News', 'url': 'https://www.scientianews.org/physics-nobel-prize-winners', 'content': 'The next female Nobel Prize in@@ -163,6 +165,7 @@ the only person who has received the Nobel Prize in Physics twice, year 1956and 1972 . Marie Curie was awarded the Nobel Prize twice, once in physics 1903and once in chemistry 1911.. See the list of multiple Nobel Prize laureateswithin other Nobel Prize categories here'}]}+==============================================================================="""search_linkup_response = SearchToolkit().search_linkup(@@ -173,6 +176,7 @@ search_linkup_response = SearchToolkit().search_linkup(print(search_linkup_response)"""+==============================================================================={'answer': "The women who have been awarded the Nobel Prize in Physics are: 1.Marie Curie - 1903 2. Maria Goeppert Mayer - 1963 3. Donna Strickland - 20184. Anne L'Huillier - 2023", 'sources': [{'name': 'Nobel Prize awarded women -@@ -188,7 +192,7 @@ Strickland.'}, {'name': 'List of female Nobel laureates - Wikipedia', 'url':"The most recent women to be awarded a Nobel Prize were Han Kang in Literature(2024), Claudia Goldin in Economics, Narges Mohammadi for Peace, AnneL'Huillier in Physics and Katalin Karikó in Physiology or Medicine (2023)."}]}-(camel-ai-py3.10) ruihan@RuideMac-mini camel %+==============================================================================="""@@ -207,11 +211,13 @@ search_linkup_response = SearchToolkit().search_linkup(print(search_linkup_response)"""+==============================================================================={'name': 'Female Nobel Prize Winners in Physics', 'description': 'The womenawarded the Nobel Prize in Physics include: 1. Marie Curie (1903) 2. MariaGoeppert-Mayer (1963) 3. Donna Strickland (2018) 4. (4th winner not mentionedin the provided data) 5. (5th winner not mentioned in the provided data). Lessthan 5 women have won the Nobel Prize in Physics out of 225 total laureates.'}+==============================================================================="""search_bocha_response = SearchToolkit().search_bocha(@@ -223,6 +229,7 @@ search_bocha_response = SearchToolkit().search_bocha(print(search_bocha_response)"""+==============================================================================={"_type":"SearchResponse","queryContext":{"originalQuery":"阿里巴巴2024年的esg报告"},"webPages":{"webSearchUrl":"","totalEstimatedMatches":8912791,"value":[{"id":None,"name":"阿里巴巴发布2024年ESG报告持续推进减碳与数字化普惠","url":"ht@@ -242,4 +249,5 @@ m.sohu.com/a/796245119_121713887/?pvid=000115_3w_a","contentSize":None,"encodingFormat":None,"hostPageDisplayUrl":"https://m.sohu.com/a/796245119_121713887/?pvid=000115_3w_a","width":1285,"height":722,"thumbnail":None}],"isFamilyFriendly":None},"videos":None}+==============================================================================="""diff --git a/examples/toolkits/web_toolkit.py b/examples/toolkits/web_toolkit.pyindex 99b0b7916..606babdaa 100644--- a/examples/toolkits/web_toolkit.py+++ b/examples/toolkits/web_toolkit.py@@ -16,7 +16,7 @@from camel.agents import ChatAgentfrom camel.configs import ChatGPTConfigfrom camel.models import ModelFactory-from camel.toolkits import WebToolkit+from camel.toolkits import BrowserToolkitfrom camel.types import ModelPlatformType, ModelTypemodel = ModelFactory.create(@@ -43,7 +43,7 @@ planning_agent_model = ModelFactory.create().as_dict(),)-web_toolkit = WebToolkit(+web_toolkit = BrowserToolkit(headless=False,web_agent_model=web_agent_model,planning_agent_model=planning_agent_model,diff --git a/pyproject.toml b/pyproject.tomlindex 6c56a212e..febfa3496 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "camel-ai"-version = "0.2.26"+version = "0.2.27"description = "Communicative Agents for AI Society Study"authors = [{ name = "CAMEL-AI.org" }]requires-python = ">=3.10,<3.13"diff --git a/test/models/test_volcano_model.py b/test/models/test_volcano_model.pyindex 207486b52..2599bff77 100644--- a/test/models/test_volcano_model.py+++ b/test/models/test_volcano_model.py@@ -16,7 +16,6 @@ import reimport pytestfrom camel.models import VolcanoModel-from camel.types import ModelTypefrom camel.utils import OpenAITokenCounter@@ -44,4 +43,4 @@ def test_volcano_model_unexpected_argument():)),):- _ = VolcanoModel(model_type, model_config_dict)\ No newline at end of file+ _ = VolcanoModel(model_type, model_config_dict)diff --git a/uv.lock b/uv.lockindex cd0fdca12..0eb79f312 100644--- a/uv.lock+++ b/uv.lock@@ -510,7 +510,7 @@ wheels = [[[package]]name = "camel-ai"-version = "0.2.26"+version = "0.2.27"source = { editable = "." }dependencies = [{ name = "colorama" },@@ -4737,6 +4737,7 @@ sdist = { url = "https://files.pythonhosted.org/packages/06/47/b61c1c44b87cbdaeewheels = [{ url = "https://files.pythonhosted.org/packages/61/9b/98ef4b98309e9db3baa9fe572f0e61b6130bb9852d13189970f35b703499/pymupdf-1.25.3-cp39-abi3-macosx_10_9_x86_64.whl", hash = "sha256:96878e1b748f9c2011aecb2028c5f96b5a347a9a91169130ad0133053d97915e", size = 19343576 },{ url = "https://files.pythonhosted.org/packages/14/62/4e12126db174c8cfbf692281cda971cc4046c5f5226032c2cfaa6f83e08d/pymupdf-1.25.3-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:6ef753005b72ebfd23470f72f7e30f61e21b0b5e748045ec5b8f89e6e3068d62", size = 18580114 },+ { url = "https://files.pythonhosted.org/packages/ec/c5/cf7ecf005e4f8ba3664d6aaa0613adeba4c2ab524832c452c69857e7184f/pymupdf-1.25.3-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cbff443d899f37b17f1e67563cc03673d50b4bf33ccc237e73d34f18f3a07ccf", size = 19442580 },{ url = "https://files.pythonhosted.org/packages/52/de/bd1418e31f73d37b8381cd5deacfd681e6be702b8890e123e83724569ee1/pymupdf-1.25.3-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:46d90c4f9e62d1856e8db4b9f04a202ff4a7f086a816af73abdc86adb7f5e25a", size = 19999825 },{ url = "https://files.pythonhosted.org/packages/42/ee/3c449b0de061440ba1ac984aa845315e9e2dca0ff2003c5adfc6febff203/pymupdf-1.25.3-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a5de51efdbe4d486b6c1111c84e8a231cbfb426f3d6ff31ab530ad70e6f39756", size = 21123157 },{ url = "https://files.pythonhosted.org/packages/83/53/71faaaf91c56f2883b13f3dd849bf2697f012eb35eb7b952d62734cff41f/pymupdf-1.25.3-cp39-abi3-win32.whl", hash = "sha256:bca72e6089f985d800596e22973f79cc08af6cbff1d93e5bda9248326a03857c", size = 15094211 },