🐫 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: output_language setting in ChatAgent (#1165)
Wendong-Fan32f19f59f4ff
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 26c25a0d8..3c08d8b21 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.6+ placeholder: E.g., 0.2.7validations:required: truediff --git a/README.md b/README.mdindex f1f12720d..8a60ceff2 100644--- a/README.md+++ b/README.md@@ -144,7 +144,7 @@ conda create --name camel python=3.10conda activate camel# Clone github repo-git clone -b v0.2.6 https://github.com/camel-ai/camel.git+git clone -b v0.2.7 https://github.com/camel-ai/camel.git# Change directory into project directorycd cameldiff --git a/camel/__init__.py b/camel/__init__.pyindex da74eb223..9f5ed3a4a 100644--- a/camel/__init__.py+++ b/camel/__init__.py@@ -12,7 +12,7 @@# limitations under the License.# =========== Copyright 2023 @ CAMEL-AI.org. All Rights Reserved. ===========-__version__ = '0.2.6'+__version__ = '0.2.7'__all__ = ['__version__',diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.pyindex 1c5f9a2c4..fb1d79c4a 100644--- a/camel/agents/chat_agent.py+++ b/camel/agents/chat_agent.py@@ -180,9 +180,6 @@ class ChatAgent(BaseAgent):model_type=ModelType.DEFAULT,))- self.output_language: Optional[str] = output_language- if self.output_language is not None:- self.set_output_language(self.output_language)self.model_type = self.model_backend.model_type@@ -218,6 +215,10 @@ class ChatAgent(BaseAgent):context_creator, window_size=message_window_size)+ self.output_language: Optional[str] = output_language+ if self.output_language is not None:+ self.set_output_language(self.output_language)+self.terminated: bool = Falseself.response_terminators = response_terminators or []self.init_messages()@@ -371,13 +372,19 @@ class ChatAgent(BaseAgent):self._system_message = self.orig_sys_message.create_new_instance(content)- return self._system_messageelse:self._system_message = BaseMessage.make_assistant_message(role_name="Assistant",content=language_prompt,)- return self._system_message++ system_record = MemoryRecord(+ message=self._system_message,+ role_at_backend=OpenAIBackendRole.SYSTEM,+ )+ self.memory.clear()+ self.memory.write_record(system_record)+ return self._system_messagedef get_info(self,diff --git a/docs/conf.py b/docs/conf.pyindex d8d027bb8..08d34f2c3 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.6'+release = '0.2.7'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/docs/cookbooks/agents_message.ipynb b/docs/cookbooks/agents_message.ipynbindex ed4800c7b..58d523aec 100644--- a/docs/cookbooks/agents_message.ipynb+++ b/docs/cookbooks/agents_message.ipynb@@ -101,7 +101,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.6\""+ "!pip install \"camel-ai==0.2.7\""]},{diff --git a/docs/cookbooks/agents_prompting.ipynb b/docs/cookbooks/agents_prompting.ipynbindex 7e393b220..448a2f643 100644--- a/docs/cookbooks/agents_prompting.ipynb+++ b/docs/cookbooks/agents_prompting.ipynb@@ -64,7 +64,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.6\""+ "!pip install \"camel-ai==0.2.7\""]},{diff --git a/docs/cookbooks/agents_society.ipynb b/docs/cookbooks/agents_society.ipynbindex a7bac22e6..5342791a7 100644--- a/docs/cookbooks/agents_society.ipynb+++ b/docs/cookbooks/agents_society.ipynb@@ -192,7 +192,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.6\""+ "!pip install \"camel-ai==0.2.7\""]},{diff --git a/docs/cookbooks/agents_tracking.ipynb b/docs/cookbooks/agents_tracking.ipynbindex a2522bf33..61a9f0dc7 100644--- a/docs/cookbooks/agents_tracking.ipynb+++ b/docs/cookbooks/agents_tracking.ipynb@@ -64,7 +64,7 @@},"outputs": [],"source": [- "%pip install camel-ai[all]==0.2.6\n",+ "%pip install camel-ai[all]==0.2.7\n","%pip install agentops==0.3.10"]},diff --git a/docs/cookbooks/agents_with_memory.ipynb b/docs/cookbooks/agents_with_memory.ipynbindex 334bbf9fd..3ef3e1b8a 100644--- a/docs/cookbooks/agents_with_memory.ipynb+++ b/docs/cookbooks/agents_with_memory.ipynb@@ -73,7 +73,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.6\""+ "!pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/cookbooks/agents_with_rag.ipynb b/docs/cookbooks/agents_with_rag.ipynbindex d0d5c4ad4..9894ebd16 100644--- a/docs/cookbooks/agents_with_rag.ipynb+++ b/docs/cookbooks/agents_with_rag.ipynb@@ -75,7 +75,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.6\""+ "!pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/cookbooks/agents_with_tools.ipynb b/docs/cookbooks/agents_with_tools.ipynbindex eae19ddb4..d21df02c6 100644--- a/docs/cookbooks/agents_with_tools.ipynb+++ b/docs/cookbooks/agents_with_tools.ipynb@@ -77,7 +77,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.6\""+ "!pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/cookbooks/create_your_first_agent.ipynb b/docs/cookbooks/create_your_first_agent.ipynbindex 3eb0977c2..b5577974c 100644--- a/docs/cookbooks/create_your_first_agent.ipynb+++ b/docs/cookbooks/create_your_first_agent.ipynb@@ -83,7 +83,7 @@{"cell_type": "code","source": [- "!pip install \"camel-ai[all]==0.2.6\""+ "!pip install \"camel-ai[all]==0.2.7\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/create_your_first_agents_society.ipynb b/docs/cookbooks/create_your_first_agents_society.ipynbindex c9cf04204..7c8704e4e 100644--- a/docs/cookbooks/create_your_first_agents_society.ipynb+++ b/docs/cookbooks/create_your_first_agents_society.ipynb@@ -77,7 +77,7 @@{"cell_type": "code","source": [- "!pip install \"camel-ai==0.2.6\""+ "!pip install \"camel-ai==0.2.7\""],"metadata": {"id": "RiwfwyyLYYxo"diff --git a/docs/cookbooks/critic_agents_and_tree_search.ipynb b/docs/cookbooks/critic_agents_and_tree_search.ipynbindex 678012455..ec7289ead 100644--- a/docs/cookbooks/critic_agents_and_tree_search.ipynb+++ b/docs/cookbooks/critic_agents_and_tree_search.ipynb@@ -84,7 +84,7 @@{"cell_type": "code","source": [- "%pip install \"camel-ai==0.2.6\""+ "%pip install \"camel-ai==0.2.7\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/embodied_agents.ipynb b/docs/cookbooks/embodied_agents.ipynbindex 4c5eb710b..1b861ee39 100644--- a/docs/cookbooks/embodied_agents.ipynb+++ b/docs/cookbooks/embodied_agents.ipynb@@ -67,7 +67,7 @@{"cell_type": "code","source": [- "%pip install \"camel-ai==0.2.6\""+ "%pip install \"camel-ai==0.2.7\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/knowledge_graph.ipynb b/docs/cookbooks/knowledge_graph.ipynbindex 0aa8510a4..90995ab75 100644--- a/docs/cookbooks/knowledge_graph.ipynb+++ b/docs/cookbooks/knowledge_graph.ipynb@@ -73,7 +73,7 @@},"outputs": [],"source": [- "pip install \"camel-ai[all]==0.2.6\""+ "pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/cookbooks/model_speed_comparison.ipynb b/docs/cookbooks/model_speed_comparison.ipynbindex 06acc253b..81f81f351 100644--- a/docs/cookbooks/model_speed_comparison.ipynb+++ b/docs/cookbooks/model_speed_comparison.ipynb@@ -63,7 +63,7 @@{"cell_type": "code","source": [- "!pip install \"camel-ai==0.2.6\""+ "!pip install \"camel-ai==0.2.7\""],"metadata": {"id": "UtcC3c-KVZmU"diff --git a/docs/cookbooks/roleplaying_scraper.ipynb b/docs/cookbooks/roleplaying_scraper.ipynbindex ce7feb469..2819deda5 100644--- a/docs/cookbooks/roleplaying_scraper.ipynb+++ b/docs/cookbooks/roleplaying_scraper.ipynb@@ -89,7 +89,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai[all]==0.2.6\""+ "!pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/cookbooks/task_generation.ipynb b/docs/cookbooks/task_generation.ipynbindex ab00c67b3..be51664f7 100644--- a/docs/cookbooks/task_generation.ipynb+++ b/docs/cookbooks/task_generation.ipynb@@ -62,7 +62,7 @@},"outputs": [],"source": [- "!pip install \"camel-ai==0.2.6\""+ "!pip install \"camel-ai==0.2.7\""]},{diff --git a/docs/cookbooks/video_analysis.ipynb b/docs/cookbooks/video_analysis.ipynbindex b028581cc..7f5de0eab 100644--- a/docs/cookbooks/video_analysis.ipynb+++ b/docs/cookbooks/video_analysis.ipynb@@ -28,7 +28,7 @@},"outputs": [],"source": [- "%pip install \"camel-ai[all]==0.2.6\""+ "%pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/cookbooks/workforce_judge_committee.ipynb b/docs/cookbooks/workforce_judge_committee.ipynbindex f8471a40a..0ef349742 100644--- a/docs/cookbooks/workforce_judge_committee.ipynb+++ b/docs/cookbooks/workforce_judge_committee.ipynb@@ -28,7 +28,7 @@},"outputs": [],"source": [- "%pip install \"camel-ai[all]==0.2.6\""+ "%pip install \"camel-ai[all]==0.2.7\""]},{diff --git a/docs/get_started/installation.md b/docs/get_started/installation.mdindex 495907b2f..57aa1e64a 100644--- a/docs/get_started/installation.md+++ b/docs/get_started/installation.md@@ -60,7 +60,7 @@ conda create --name camel python=3.10conda activate camel# Clone github repo-git clone -b v0.2.6 https://github.com/camel-ai/camel.git+git clone -b v0.2.7 https://github.com/camel-ai/camel.git# Change directory into project directorycd cameldiff --git a/docs/key_modules/loaders.md b/docs/key_modules/loaders.mdindex ee5b13fba..5818aba93 100644--- a/docs/key_modules/loaders.md+++ b/docs/key_modules/loaders.md@@ -336,14 +336,14 @@ response = jina_reader.read_content("https://docs.camel-ai.org/")print(response)``````markdown->>>Welcome to CAMEL’s documentation! — CAMEL 0.2.6 documentation+>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.7 documentation===============[Skip to main content](https://docs.camel-ai.org/#main-content)Back to top Ctrl+K- [ CAMEL 0.2.6](https://docs.camel-ai.org/#)+ [ CAMEL 0.2.7](https://docs.camel-ai.org/#)Search Ctrl+Kdiff --git a/pyproject.toml b/pyproject.tomlindex 6e49331e7..17506ed08 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"[tool.poetry]name = "camel-ai"-version = "0.2.6"+version = "0.2.7"authors = ["CAMEL-AI.org"]description = "Communicative Agents for AI Society Study"readme = "README.md"diff --git a/test/agents/test_chat_agent.py b/test/agents/test_chat_agent.pyindex ba28ec314..290c5bc46 100644--- a/test/agents/test_chat_agent.py+++ b/test/agents/test_chat_agent.py@@ -414,14 +414,13 @@ def test_set_output_language():assert agent.output_language == output_language# Verify that the system message is updated with the new output language- updated_system_message = BaseMessage(- role_name="assistant",- role_type=RoleType.ASSISTANT,- meta_dict=None,- content="You are a help assistant."- "\nRegardless of the input language, you must output text in Arabic.",- )- assert agent.system_message.content == updated_system_message.content+ updated_system_message = {+ 'role': 'system',+ 'content': 'You are a help assistant.\nRegardless of the '+ 'input language, you must output text in Arabic.',+ }+ memory_content = agent.memory.get_context()+ assert memory_content[0][0] == updated_system_message@pytest.mark.model_backend@@ -444,28 +443,27 @@ def test_set_multiple_output_language():agent_without_sys_msg.set_output_language("English")agent_without_sys_msg.set_output_language("French")- updated_system_message_with_content = BaseMessage(- role_name="assistant",- role_type=RoleType.ASSISTANT,- meta_dict=None,- content="You are a help assistant."- "\nRegardless of the input language, you must output text in French.",- )- updated_system_message_without_content = BaseMessage(- role_name="assistant",- role_type=RoleType.ASSISTANT,- meta_dict=None,- content="\nRegardless of the input language, you must output text "- "in French.",- )+ updated_system_message_with_sys_msg = {+ 'role': 'system',+ 'content': 'You are a help assistant.\nRegardless of the '+ 'input language, you must output text in French.',+ }+ updated_system_message_without_sys_msg = {+ 'role': 'system',+ 'content': '\nRegardless of the input language, you must output '+ 'text in French.',+ }++ memory_content_with_sys_msg = agent_with_sys_msg.memory.get_context()+ memory_content_without_sys_msg = agent_without_sys_msg.memory.get_context()assert (- agent_with_sys_msg.system_message.content- == updated_system_message_with_content.content+ memory_content_with_sys_msg[0][0]+ == updated_system_message_with_sys_msg)assert (- agent_without_sys_msg.system_message.content- == updated_system_message_without_content.content+ memory_content_without_sys_msg[0][0]+ == updated_system_message_without_sys_msg)