Skip to content

Commit 2d2a295

Browse files
authored
fix: enhance new feature implementation (#1826)
1 parent 107cd89 commit 2d2a295

19 files changed

+58
-53
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body:
2626
attributes:
2727
label: What version of camel are you using?
2828
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
29-
placeholder: E.g., 0.2.26
29+
placeholder: E.g., 0.2.27
3030
validations:
3131
required: true
3232

.github/workflows/build_package.yml

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797
MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"
9898
AIML_API_KEY: "${{ secrets.AIML_API_KEY }}"
9999
NVIDIA_API_KEY: "${{ secrets.NVIDIA_API_KEY }}"
100+
VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"
100101
run: |
101102
source test_venv/bin/activate
102103
pytest --fast-test-mode ./test

.github/workflows/pytest_package.yml

+3
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ jobs:
6262
MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"
6363
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
6464
AIML_API_KEY: "${{ secrets.AIML_API_KEY }}"
65+
VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"
6566
run: |
6667
source .venv/bin/activate
6768
uv pip install -e ".[all, dev, docs]"
@@ -116,6 +117,7 @@ jobs:
116117
MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"
117118
SILICONFLOW_API_KEY: "${{ secrets.SILICONFLOW_API_KEY }}"
118119
AIML_API_KEY: "${{ secrets.AIML_API_KEY }}"
120+
VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"
119121
run: |
120122
source .venv/bin/activate
121123
uv pip install -e ".[all, dev, docs]"
@@ -168,6 +170,7 @@ jobs:
168170
INTERNLM_API_KEY: "${{ secrets.INTERNLM_API_KEY }}"
169171
JINA_API_KEY: "${{ secrets.JINA_API_KEY }}"
170172
MOONSHOT_API_KEY: "${{ secrets.MOONSHOT_API_KEY }}"
173+
VOLCANO_API_KEY: "${{ secrets.VOLCANO_API_KEY }}"
171174
run: |
172175
source .venv/bin/activate
173176
uv pip install -e ".[all, dev, docs]"

camel/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from camel.logger import disable_logging, enable_logging, set_log_level
1616

17-
__version__ = '0.2.26'
17+
__version__ = '0.2.27'
1818

1919
__all__ = [
2020
'__version__',

camel/models/volcano_model.py

+5-8
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,11 @@
1313
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
1414

1515
import os
16-
from typing import Any, Dict, List, Optional, Type, Union
17-
18-
from pydantic import BaseModel
16+
from typing import Any, Dict, Optional, Union
1917

2018
from camel.configs import OPENAI_API_PARAMS
21-
from camel.messages import OpenAIMessage
2219
from camel.models.openai_compatible_model import OpenAICompatibleModel
23-
from camel.types import ChatCompletion, ModelType
20+
from camel.types import ModelType
2421
from camel.utils import (
2522
BaseTokenCounter,
2623
OpenAITokenCounter,
@@ -61,14 +58,14 @@ def __init__(
6158
) -> None:
6259
if model_config_dict is None:
6360
model_config_dict = {}
64-
61+
6562
api_key = api_key or os.environ.get("VOLCANO_API_KEY")
6663
url = (
6764
url
6865
or os.environ.get("VOLCANO_API_BASE_URL")
6966
or "https://ark.cn-beijing.volces.com/api/v3"
7067
)
71-
68+
7269
super().__init__(
7370
model_type, model_config_dict, api_key, url, token_counter
7471
)
@@ -100,4 +97,4 @@ def check_model_config(self):
10097
raise ValueError(
10198
f"Unexpected argument `{param}` is "
10299
"input into Volcano model backend."
103-
)
100+
)

camel/toolkits/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
from .video_analysis_toolkit import VideoAnalysisToolkit
5656
from .image_analysis_toolkit import ImageAnalysisToolkit
5757
from .mcp_toolkit import MCPToolkit
58-
from .web_toolkit import WebToolkit
58+
from .browser_toolkit import BrowserToolkit
5959
from .file_write_toolkit import FileWriteToolkit
6060
from .terminal_toolkit import TerminalToolkit
6161
from .pubmed_toolkit import PubMedToolkit
@@ -102,7 +102,7 @@
102102
'ExcelToolkit',
103103
'VideoAnalysisToolkit',
104104
'ImageAnalysisToolkit',
105-
'WebToolkit',
105+
'BrowserToolkit',
106106
'FileWriteToolkit',
107107
'TerminalToolkit',
108108
'PubMedToolkit',

camel/toolkits/web_toolkit.py camel/toolkits/browser_toolkit.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ def get_webpage_content(self) -> str:
915915
return markdown_content
916916

917917

918-
class WebToolkit(BaseToolkit):
918+
class BrowserToolkit(BaseToolkit):
919919
r"""A class for browsing the web and interacting with web pages.
920920
921921
This class provides methods for browsing the web and interacting with web
@@ -931,7 +931,7 @@ def __init__(
931931
planning_agent_model: Optional[BaseModelBackend] = None,
932932
output_language: str = "en",
933933
):
934-
r"""Initialize the WebToolkit instance.
934+
r"""Initialize the BrowserToolkit instance.
935935
936936
Args:
937937
headless (bool): Whether to run the browser in headless mode.
@@ -1289,7 +1289,7 @@ def _task_replanning(
12891289
return False, replanned_schema
12901290

12911291
@dependencies_required("playwright")
1292-
def browser_simulation(
1292+
def browse_url(
12931293
self, task_prompt: str, start_url: str, round_limit: int = 12
12941294
) -> str:
12951295
r"""A powerful toolkit which can simulate the browser interaction to solve the task which needs multi-step actions.
@@ -1370,4 +1370,4 @@ def browser_simulation(
13701370
return simulation_result
13711371

13721372
def get_tools(self) -> List[FunctionTool]:
1373-
return [FunctionTool(self.browser_simulation)]
1373+
return [FunctionTool(self.browse_url)]

camel/toolkits/search_toolkit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ def search_bocha(
731731
732732
Returns:
733733
Dict[str, Any]: A dictionary containing search results, including
734-
web pages, images, and videos if available. The structure follows
735-
the Bocha AI search API response format.
734+
web pages, images, and videos if available. The structure
735+
follows the Bocha AI search API response format.
736736
"""
737737
import json
738738

camel/types/enums.py

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ def support_native_tool_calling(self) -> bool:
249249
self.is_siliconflow,
250250
self.is_zhipuai,
251251
self.is_aiml,
252+
self.is_azure_openai,
252253
]
253254
)
254255

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
project = 'CAMEL'
2828
copyright = '2024, CAMEL-AI.org'
2929
author = 'CAMEL-AI.org'
30-
release = '0.2.26'
30+
release = '0.2.27'
3131

3232
html_favicon = (
3333
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'

docs/key_modules/loaders.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,14 @@ response = jina_reader.read_content("https://docs.camel-ai.org/")
340340
print(response)
341341
```
342342
```markdown
343-
>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.26 documentation
343+
>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.27 documentation
344344
===============
345345

346346
[Skip to main content](https://docs.camel-ai.org/#main-content)
347347

348348
Back to top Ctrl+K
349349

350-
[![Image 1](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png) ![Image 2](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png)CAMEL 0.2.26](https://docs.camel-ai.org/#)
350+
[![Image 1](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png) ![Image 2](https://raw.githubusercontent.com/camel-ai/camel/master/misc/logo_light.png)CAMEL 0.2.27](https://docs.camel-ai.org/#)
351351

352352
Search Ctrl+K
353353

docs/key_modules/tools.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ CAMEL provides a variety of built-in toolkits that you can use right away. Here'
183183
| VideoAnalysisToolkit | A toolkit for analyzing video content with vision-language models, including frame extraction and question answering about video content. |
184184
| VideoDownloaderToolkit | A toolkit for downloading videos and optionally splitting them into chunks, with support for various video services. |
185185
| WeatherToolkit | A toolkit for fetching weather data for cities using the OpenWeatherMap API. |
186-
| WebToolkit | A toolkit for browsing the web and interacting with web pages, including browser simulation and content extraction. |
186+
| BrowserToolkit | A toolkit for browsing the web and interacting with web pages, including browser simulation and content extraction. |
187187
| WhatsAppToolkit | A toolkit for interacting with the WhatsApp Business API, including sending messages, managing message templates, and accessing business profile information. |
188188
| ZapierToolkit | A toolkit for interacting with Zapier's NLA API to execute actions through natural language commands and automate workflows. |
189189

examples/models/role_playing_with_volcano.py

+15-20
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
# limitations under the License.
1313
# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
1414

15-
import os
1615
from typing import Dict, List, Optional, Tuple
1716

18-
from camel.societies import RolePlaying
19-
from camel.configs import ChatGPTConfig
2017
from camel.models import ModelFactory
18+
from camel.societies import RolePlaying
2119
from camel.types import ModelPlatformType
2220
from camel.utils import print_text_animated
2321

@@ -41,7 +39,7 @@ def main(
4139
with_task_specify: bool = True,
4240
model_config_dict: Optional[Dict] = None,
4341
) -> Tuple[List[Dict], List[Dict]]:
44-
"""Run a role-playing session with Volcano Engine API.
42+
r"""Run a role-playing session with Volcano Engine API.
4543
4644
Args:
4745
assistant_role_name: The role name of the assistant.
@@ -54,18 +52,10 @@ def main(
5452
A tuple of assistant and user message lists.
5553
"""
5654
if model_config_dict is None:
57-
model_config_dict = ChatGPTConfig(
58-
temperature=0.2,
59-
max_tokens=1024,
60-
).as_dict()
61-
62-
# Check if VOLCANO_API_KEY is set
63-
api_key = os.environ.get("VOLCANO_API_KEY")
64-
if not api_key:
65-
raise ValueError(
66-
"VOLCANO_API_KEY environment variable is not set. "
67-
"Please set it before running this example."
68-
)
55+
model_config_dict = {
56+
"temperature": 0.2,
57+
"max_tokens": 1024,
58+
}
6959

7060
# Create models for assistant and user
7161
assistant_model = ModelFactory.create(
@@ -104,7 +94,9 @@ def main(
10494
input_msg = role_playing.init_chat() # Initialize the chat
10595
while n < 10:
10696
n += 1
107-
assistant_response, user_response = role_playing.step(input_msg) # Provide input_msg
97+
assistant_response, user_response = role_playing.step(
98+
input_msg
99+
) # Provide input_msg
108100
if assistant_response is None or user_response is None:
109101
break
110102

@@ -126,10 +118,13 @@ def main(
126118
if "<CAMEL_TASK_DONE>" in user_response.msg.content:
127119
break
128120

129-
input_msg = assistant_response.msg # Update input_msg for the next step
121+
input_msg = (
122+
assistant_response.msg
123+
) # Update input_msg for the next step
130124

131-
# return role_playing.assistant_agent.chat_history, role_playing.user_agent.chat_history
125+
# return role_playing.assistant_agent.chat_history, role_playing.
126+
# user_agent.chat_history
132127

133128

134129
if __name__ == "__main__":
135-
main()
130+
main()

examples/models/volcano_model_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444

4545
# Get response information
4646
response = camel_agent.step(user_msg)
47-
print(response.msgs[0].content)
47+
print(response.msgs[0].content)

examples/toolkits/search_toolkit.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@
7878
response = agent.step(input_message=usr_msg, response_format=None)
7979

8080
print(response.msgs[0].content)
81-
'''
81+
"""
82+
===============================================================================
8283
The current temperature in Tokyo can be found on various weather websites.
8384
Here are a couple of reliable sources where you can check the latest weather
8485
conditions:
@@ -88,8 +89,8 @@
8889
8990
You can visit these links to get the most up-to-date temperature and weather
9091
conditions in Tokyo.
91-
'''
92-
92+
===============================================================================
93+
"""
9394
search_linkup_response = SearchToolkit().search_linkup(
9495
query="Can you tell me which women were awared the Physics Nobel Prize",
9596
depth="standard",
@@ -98,6 +99,7 @@
9899

99100
print(search_linkup_response)
100101
"""
102+
===============================================================================
101103
{'results': [{'type': 'text', 'name': 'Physics Nobel Prizes awarded to women |
102104
Scientia News', 'url': 'https://www.scientianews.org/
103105
physics-nobel-prize-winners', 'content': 'The next female Nobel Prize in
@@ -163,6 +165,7 @@
163165
and 1972 . Marie Curie was awarded the Nobel Prize twice, once in physics 1903
164166
and once in chemistry 1911.. See the list of multiple Nobel Prize laureates
165167
within other Nobel Prize categories here'}]}
168+
===============================================================================
166169
"""
167170

168171
search_linkup_response = SearchToolkit().search_linkup(
@@ -173,6 +176,7 @@
173176

174177
print(search_linkup_response)
175178
"""
179+
===============================================================================
176180
{'answer': "The women who have been awarded the Nobel Prize in Physics are: 1.
177181
Marie Curie - 1903 2. Maria Goeppert Mayer - 1963 3. Donna Strickland - 2018
178182
4. Anne L'Huillier - 2023", 'sources': [{'name': 'Nobel Prize awarded women -
@@ -188,7 +192,7 @@
188192
"The most recent women to be awarded a Nobel Prize were Han Kang in Literature
189193
(2024), Claudia Goldin in Economics, Narges Mohammadi for Peace, Anne
190194
L'Huillier in Physics and Katalin Karikó in Physiology or Medicine (2023)."}]}
191-
(camel-ai-py3.10) ruihan@RuideMac-mini camel %
195+
===============================================================================
192196
"""
193197

194198

@@ -207,11 +211,13 @@ class PersonInfo(BaseModel):
207211
print(search_linkup_response)
208212

209213
"""
214+
===============================================================================
210215
{'name': 'Female Nobel Prize Winners in Physics', 'description': 'The women
211216
awarded the Nobel Prize in Physics include: 1. Marie Curie (1903) 2. Maria
212217
Goeppert-Mayer (1963) 3. Donna Strickland (2018) 4. (4th winner not mentioned
213218
in the provided data) 5. (5th winner not mentioned in the provided data). Less
214219
than 5 women have won the Nobel Prize in Physics out of 225 total laureates.'}
220+
===============================================================================
215221
"""
216222

217223
search_bocha_response = SearchToolkit().search_bocha(
@@ -223,6 +229,7 @@ class PersonInfo(BaseModel):
223229
print(search_bocha_response)
224230

225231
"""
232+
===============================================================================
226233
{"_type":"SearchResponse","queryContext":{"originalQuery":"阿里巴巴2024年的esg报
227234
告"},"webPages":{"webSearchUrl":"","totalEstimatedMatches":8912791,"value":[
228235
{"id":None,"name":"阿里巴巴发布2024年ESG报告持续推进减碳与数字化普惠","url":"ht
@@ -242,4 +249,5 @@ class PersonInfo(BaseModel):
242249
dingFormat":None,"hostPageDisplayUrl":"https://m.sohu.com/a/796245119_121713887
243250
/?pvid=000115_3w_a","width":1285,"height":722,"thumbnail":None}],"isFamilyFrien
244251
dly":None},"videos":None}
252+
===============================================================================
245253
"""

examples/toolkits/web_toolkit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from camel.agents import ChatAgent
1717
from camel.configs import ChatGPTConfig
1818
from camel.models import ModelFactory
19-
from camel.toolkits import WebToolkit
19+
from camel.toolkits import BrowserToolkit
2020
from camel.types import ModelPlatformType, ModelType
2121

2222
model = ModelFactory.create(
@@ -43,7 +43,7 @@
4343
).as_dict(),
4444
)
4545

46-
web_toolkit = WebToolkit(
46+
web_toolkit = BrowserToolkit(
4747
headless=False,
4848
web_agent_model=web_agent_model,
4949
planning_agent_model=planning_agent_model,

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "camel-ai"
7-
version = "0.2.26"
7+
version = "0.2.27"
88
description = "Communicative Agents for AI Society Study"
99
authors = [{ name = "CAMEL-AI.org" }]
1010
requires-python = ">=3.10,<3.13"

0 commit comments

Comments
 (0)