🐫 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
chore: Update message setting (#1506)
Wendong-Fan9830139bade7
diff --git a/camel/agents/knowledge_graph_agent.py b/camel/agents/knowledge_graph_agent.pyindex a1187f047..e527362b6 100644--- a/camel/agents/knowledge_graph_agent.py+++ b/camel/agents/knowledge_graph_agent.py@@ -165,11 +165,7 @@ class KnowledgeGraphAgent(ChatAgent):task=str(element))- knowledge_graph_generation_msg = BaseMessage.make_user_message(- role_name="Graphify", content=knowledge_graph_generation- )-- response = self.step(input_message=knowledge_graph_generation_msg)+ response = self.step(input_message=knowledge_graph_generation)content = response.msg.contentdiff --git a/camel/benchmarks/apibench.py b/camel/benchmarks/apibench.pyindex 7e38d44b4..284cc2231 100644--- a/camel/benchmarks/apibench.py+++ b/camel/benchmarks/apibench.py@@ -24,7 +24,6 @@ from tree_sitter import Language, Parserfrom camel.agents import ChatAgentfrom camel.benchmarks.base import BaseBenchmark-from camel.messages import BaseMessagefrom camel.utils import download_github_subdirectorylogger = logging.getLogger(__name__)@@ -281,12 +280,9 @@ class APIBenchBenchmark(BaseBenchmark):with open(self.save_to, "w") as f:for question in tqdm(datas, desc="Running"):prompt = encode_question(question["text"], dataset_name)- msg = BaseMessage.make_user_message(- role_name="User", content=prompt- )try:# Generate response- responses = agent.step(msg)+ responses = agent.step(prompt)response = responses.msgs[0].contentapi_database = self._data['api']qa_pairs = self._data['eval']diff --git a/camel/benchmarks/nexus.py b/camel/benchmarks/nexus.pyindex 0cb5064c3..dc3e65aca 100644--- a/camel/benchmarks/nexus.py+++ b/camel/benchmarks/nexus.py@@ -28,7 +28,6 @@ from tqdm import tqdmfrom camel.agents import ChatAgentfrom camel.benchmarks.base import BaseBenchmark-from camel.messages import BaseMessagelogger = logging.getLogger(__name__)@@ -309,13 +308,10 @@ class NexusBenchmark(BaseBenchmark):with open(self.save_to, "w") as f:for sample in tqdm(datas, desc="Running"):prompt = construct_prompt(input=sample.input, tools=tools)- msg = BaseMessage.make_user_message(- role_name="User", content=prompt- )ground_truth_call = sample.outputtry:# Generate response- response = agent.step(msg)+ response = agent.step(prompt)agent_call = response.msgs[0].content# Evaluate responsediff --git a/camel/bots/telegram_bot.py b/camel/bots/telegram_bot.pyindex 6c502efeb..b718e1b28 100644--- a/camel/bots/telegram_bot.py+++ b/camel/bots/telegram_bot.py@@ -15,7 +15,6 @@ import osfrom typing import TYPE_CHECKING, Optionalfrom camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.utils import dependencies_required# Conditionally import telebot types only for type checking@@ -74,9 +73,6 @@ class TelegramBot:if not message.text:return- user_msg = BaseMessage.make_user_message(- role_name="User", content=message.text- )- assistant_response = self.chat_agent.step(user_msg)+ assistant_response = self.chat_agent.step(message.text)self.bot.reply_to(message, assistant_response.msg.content)diff --git a/camel/societies/workforce/role_playing_worker.py b/camel/societies/workforce/role_playing_worker.pyindex 4d50bbf7f..b952f94f0 100644--- a/camel/societies/workforce/role_playing_worker.py+++ b/camel/societies/workforce/role_playing_worker.py@@ -168,11 +168,9 @@ class RolePlayingWorker(Worker):chat_history=chat_history_str,additional_info=task.additional_info,)- req = BaseMessage.make_user_message(- role_name="User",- content=prompt,+ response = self.summarize_agent.step(+ prompt, response_format=TaskResult)- response = self.summarize_agent.step(req, response_format=TaskResult)result_dict = json.loads(response.msg.content)task_result = TaskResult(**result_dict)task.result = task_result.contentdiff --git a/camel/societies/workforce/single_agent_worker.py b/camel/societies/workforce/single_agent_worker.pyindex 1cae7618e..64017b306 100644--- a/camel/societies/workforce/single_agent_worker.py+++ b/camel/societies/workforce/single_agent_worker.py@@ -19,7 +19,6 @@ from typing import Any, Listfrom colorama import Forefrom camel.agents import ChatAgent-from camel.messages.base import BaseMessagefrom camel.societies.workforce.prompts import PROCESS_TASK_PROMPTfrom camel.societies.workforce.utils import TaskResultfrom camel.societies.workforce.worker import Worker@@ -72,12 +71,8 @@ class SingleAgentWorker(Worker):dependency_tasks_info=dependency_tasks_info,additional_info=task.additional_info,)- req = BaseMessage.make_user_message(- role_name="User",- content=prompt,- )try:- response = self.worker.step(req, response_format=TaskResult)+ response = self.worker.step(prompt, response_format=TaskResult)except Exception as e:print(f"{Fore.RED}Error occurred while processing task {task.id}:"diff --git a/camel/societies/workforce/workforce.py b/camel/societies/workforce/workforce.pyindex 82bae09b9..5cdffb99e 100644--- a/camel/societies/workforce/workforce.py+++ b/camel/societies/workforce/workforce.py@@ -281,13 +281,9 @@ class Workforce(BaseNode):child_nodes_info=self._get_child_nodes_info(),additional_info=task.additional_info,)- req = BaseMessage.make_user_message(- role_name="User",- content=prompt,- )response = self.coordinator_agent.step(- req, response_format=TaskAssignResult+ prompt, response_format=TaskAssignResult)result_dict = json.loads(response.msg.content)task_assign_result = TaskAssignResult(**result_dict)@@ -315,11 +311,9 @@ class Workforce(BaseNode):child_nodes_info=self._get_child_nodes_info(),additional_info=task.additional_info,)- req = BaseMessage.make_user_message(- role_name="User",- content=prompt,+ response = self.coordinator_agent.step(+ prompt, response_format=WorkerConf)- response = self.coordinator_agent.step(req, response_format=WorkerConf)result_dict = json.loads(response.msg.content)new_node_conf = WorkerConf(**result_dict)diff --git a/docs/cookbooks/data_generation/self_improving_cot_generation.md b/docs/cookbooks/data_generation/self_improving_cot_generation.mdindex 33382503b..7d2a4274e 100644--- a/docs/cookbooks/data_generation/self_improving_cot_generation.md+++ b/docs/cookbooks/data_generation/self_improving_cot_generation.md@@ -159,9 +159,8 @@ from camel.datagen import SelfImprovingCoTPipeline# Initialize agentsreason_agent = ChatAgent(- "You are a struggling student who finds solving math problems challenging. "- "Your reasoning process is often flawed or lacks clarity when explaining "- "your answers to others."+ """Answer my question and give your+ final answer within \\boxed{}.""")evaluate_agent = ChatAgent(diff --git a/docs/key_modules/datagen.md b/docs/key_modules/datagen.mdindex 25f15bddb..43a9c094c 100644--- a/docs/key_modules/datagen.md+++ b/docs/key_modules/datagen.md@@ -404,9 +404,8 @@ from camel.datagen import SelfImprovingCoTPipeline# Initialize agentsreason_agent = ChatAgent(- "You are a struggling student who finds solving math problems challenging. "- "Your reasoning process is often flawed or lacks clarity when explaining "- "your answers to others."+ """Answer my question and give your+ final answer within \\boxed{}.""")evaluate_agent = ChatAgent(diff --git a/examples/ai_society/generate_meta_data.py b/examples/ai_society/generate_meta_data.pyindex 121852f9e..755d8bbf0 100644--- a/examples/ai_society/generate_meta_data.py+++ b/examples/ai_society/generate_meta_data.py@@ -12,7 +12,6 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.prompts import PromptTemplateGeneratorfrom camel.types import TaskType@@ -23,18 +22,10 @@ def main(key: str = "generate_users", num_roles: int = 50):)prompt = prompt_template.format(num_roles=num_roles)print(prompt)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",- )- agent = ChatAgent(assistant_sys_msg)+ agent = ChatAgent("You are a helpful assistant.")agent.reset()- user_msg = BaseMessage.make_user_message(- role_name="User",- content=prompt,- )- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)if assistant_response.msgs is not None:print(assistant_response.msg.content)diff --git a/examples/benchmarks/gaia.py b/examples/benchmarks/gaia.pyindex 2b6d364e8..2e4b2f629 100644--- a/examples/benchmarks/gaia.py+++ b/examples/benchmarks/gaia.py@@ -15,7 +15,6 @@from camel.agents import ChatAgentfrom camel.benchmarks import DefaultGAIARetriever, GAIABenchmark-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.runtime import RemoteHttpRuntimefrom camel.toolkits import CodeExecutionToolkit@@ -58,11 +57,6 @@ task_prompt = """a string.""".strip()-sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content=task_prompt,-)-tools = runtime.get_tools()model = ModelFactory.create(@@ -72,7 +66,7 @@ model = ModelFactory.create(agent = ChatAgent(- sys_msg,+ task_prompt,model,tools=tools,)diff --git a/examples/bots/discord_bot.py b/examples/bots/discord_bot.pyindex 70c33d643..28d58f528 100644--- a/examples/bots/discord_bot.py+++ b/examples/bots/discord_bot.py@@ -16,7 +16,6 @@ from typing import TYPE_CHECKING, List, Optional, Unionfrom camel.agents import ChatAgentfrom camel.bots import DiscordApp-from camel.messages import BaseMessagefrom camel.retrievers import AutoRetrieverfrom camel.types import StorageType@@ -54,48 +53,46 @@ class BotAgent:return_detailed_info (bool): Whether to return detailedinformation from the retriever."""- assistant_sys_msg: BaseMessage = BaseMessage.make_assistant_message(- role_name="Assistant",- content='''- Objective:- You are a customer service bot designed to assist users- with inquiries related to our open-source project.- Your responses should be informative, concise, and helpful.-- Instructions:- Understand User Queries: Carefully read and understand the- user's question. Focus on keywords and context to- determine the user's intent.- Search for Relevant Information: Use the provided dataset- and refer to the RAG (file to find answers that- closely match the user's query. The RAG file- contains detailed interactions and should be your- primary resource for crafting responses.- Provide Clear and Concise Responses: Your answers should- be clear and to the point. Avoid overly technical- language unless the user's query indicates- familiarity with technical terms.- Encourage Engagement: Where applicable, encourage users- to contribute to the project or seek further- assistance.-- Response Structure:- Greeting: Begin with a polite greeting or acknowledgment.- Main Response: Provide the main answer to the user's query.- Additional Information: Offer any extra tips or direct the- user to additional resources if necessary.- Closing: Close the response politely, encouraging- further engagement if appropriate.- bd- Tone:- Professional: Maintain a professional tone that- instills confidence in the user.- Friendly: Be approachable and friendly to make users- feel comfortable.- Helpful: Always aim to be as helpful as possible,- guiding users to solutions.- ''',- )++ assistant_sys_msg = '''+ Objective:+ You are a customer service bot designed to assist users+ with inquiries related to our open-source project.+ Your responses should be informative, concise, and helpful.++ Instructions:+ Understand User Queries: Carefully read and understand the+ user's question. Focus on keywords and context to+ determine the user's intent.+ Search for Relevant Information: Use the provided dataset+ and refer to the RAG (file to find answers that+ closely match the user's query. The RAG file+ contains detailed interactions and should be your+ primary resource for crafting responses.+ Provide Clear and Concise Responses: Your answers should+ be clear and to the point. Avoid overly technical+ language unless the user's query indicates+ familiarity with technical terms.+ Encourage Engagement: Where applicable, encourage users+ to contribute to the project or seek further+ assistance.++ Response Structure:+ Greeting: Begin with a polite greeting or acknowledgment.+ Main Response: Provide the main answer to the user's query.+ Additional Information: Offer any extra tips or direct the+ user to additional resources if necessary.+ Closing: Close the response politely, encouraging+ further engagement if appropriate.+ bd+ Tone:+ Professional: Maintain a professional tone that+ instills confidence in the user.+ Friendly: Be approachable and friendly to make users+ feel comfortable.+ Helpful: Always aim to be as helpful as possible,+ guiding users to solutions.+ '''self._agent = ChatAgent(assistant_sys_msg,@@ -139,10 +136,7 @@ class BotAgent:f"answer the query")- user_msg = BaseMessage.make_user_message(- role_name="User", content=user_raw_msg- )- assistant_response = self._agent.step(user_msg)+ assistant_response = self._agent.step(user_raw_msg)return assistant_response.msg.contentdiff --git a/examples/bots/discord_bot_use_msg_queue.py b/examples/bots/discord_bot_use_msg_queue.pyindex f3562c5c2..c7f260d82 100644--- a/examples/bots/discord_bot_use_msg_queue.py+++ b/examples/bots/discord_bot_use_msg_queue.py@@ -16,7 +16,6 @@ from typing import TYPE_CHECKING, List, Optional, Unionfrom camel.agents import ChatAgentfrom camel.bots import DiscordApp-from camel.messages import BaseMessagefrom camel.retrievers import AutoRetrieverfrom camel.types import StorageType@@ -50,48 +49,46 @@ class BotAgent:return_detailed_info (bool): Whether to return detailedinformation from the retriever."""- assistant_sys_msg: BaseMessage = BaseMessage.make_assistant_message(- role_name="Assistant",- content='''- Objective:- You are a customer service bot designed to assist users- with inquiries related to our open-source project.- Your responses should be informative, concise, and helpful.-- Instructions:- Understand User Queries: Carefully read and understand the- user's question. Focus on keywords and context to- determine the user's intent.- Search for Relevant Information: Use the provided dataset- and refer to the RAG (file to find answers that- closely match the user's query. The RAG file- contains detailed interactions and should be your- primary resource for crafting responses.- Provide Clear and Concise Responses: Your answers should- be clear and to the point. Avoid overly technical- language unless the user's query indicates- familiarity with technical terms.- Encourage Engagement: Where applicable, encourage users- to contribute to the project or seek further- assistance.-- Response Structure:- Greeting: Begin with a polite greeting or acknowledgment.- Main Response: Provide the main answer to the user's query.- Additional Information: Offer any extra tips or direct the- user to additional resources if necessary.- Closing: Close the response politely, encouraging- further engagement if appropriate.- bd- Tone:- Professional: Maintain a professional tone that- instills confidence in the user.- Friendly: Be approachable and friendly to make users- feel comfortable.- Helpful: Always aim to be as helpful as possible,- guiding users to solutions.- ''',- )++ assistant_sys_msg = '''+ Objective:+ You are a customer service bot designed to assist users+ with inquiries related to our open-source project.+ Your responses should be informative, concise, and helpful.++ Instructions:+ Understand User Queries: Carefully read and understand the+ user's question. Focus on keywords and context to+ determine the user's intent.+ Search for Relevant Information: Use the provided dataset+ and refer to the RAG (file to find answers that+ closely match the user's query. The RAG file+ contains detailed interactions and should be your+ primary resource for crafting responses.+ Provide Clear and Concise Responses: Your answers should+ be clear and to the point. Avoid overly technical+ language unless the user's query indicates+ familiarity with technical terms.+ Encourage Engagement: Where applicable, encourage users+ to contribute to the project or seek further+ assistance.++ Response Structure:+ Greeting: Begin with a polite greeting or acknowledgment.+ Main Response: Provide the main answer to the user's query.+ Additional Information: Offer any extra tips or direct the+ user to additional resources if necessary.+ Closing: Close the response politely, encouraging+ further engagement if appropriate.+ bd+ Tone:+ Professional: Maintain a professional tone that+ instills confidence in the user.+ Friendly: Be approachable and friendly to make users+ feel comfortable.+ Helpful: Always aim to be as helpful as possible,+ guiding users to solutions.+ '''self._agent = ChatAgent(assistant_sys_msg,@@ -135,10 +132,7 @@ class BotAgent:f"answer the query")- user_msg = BaseMessage.make_user_message(- role_name="User", content=user_raw_msg- )- assistant_response = self._agent.step(user_msg)+ assistant_response = self._agent.step(user_raw_msg)return assistant_response.msg.contentdiff --git a/examples/bots/slack_bot.py b/examples/bots/slack_bot.pyindex 547071239..5ff0f81a6 100644--- a/examples/bots/slack_bot.py+++ b/examples/bots/slack_bot.py@@ -20,7 +20,6 @@ from slack_sdk.web.async_client import AsyncWebClientfrom camel.agents import ChatAgentfrom camel.bots import SlackApp, SlackEventBody-from camel.messages import BaseMessagefrom camel.retrievers import AutoRetrieverfrom camel.types import StorageType@@ -56,51 +55,49 @@ class BotAgent:return_detailed_info (bool): Whether to return detailedinformation from the retriever."""- assistant_sys_msg: BaseMessage = BaseMessage.make_assistant_message(- role_name="Assistant",- content='''- Objective:- You are a customer service bot designed to assist users- with inquiries related to our open-source project.- Your responses should be informative, concise, and helpful.-- Instructions:- Understand User Queries: Carefully read and understand the- user's question. Focus on keywords and context to- determine the user's intent.- Search for Relevant Information: Use the provided dataset- and refer to the RAG (file to find answers that- closely match the user's query. The RAG file- contains detailed interactions and should be your- primary resource for crafting responses.- Provide Clear and Concise Responses: Your answers should- be clear and to the point. Avoid overly technical- language unless the user's query indicates- familiarity with technical terms.- Encourage Engagement: Where applicable, encourage users- to contribute to the project or seek further- assistance.-- Response Structure:- Greeting: Begin with a polite greeting or acknowledgment.- Main Response: Provide the main answer to the user's query.- Additional Information: Offer any extra tips or direct the- user to additional resources if necessary.- Closing: Close the response politely, encouraging- further engagement if appropriate.- bd- Tone:- Professional: Maintain a professional tone that- instills confidence in the user.- Friendly: Be approachable and friendly to make users- feel comfortable.- Helpful: Always aim to be as helpful as possible,- guiding users to solutions.- ''',- )++ content = '''+ Objective:+ You are a customer service bot designed to assist users+ with inquiries related to our open-source project.+ Your responses should be informative, concise, and helpful.++ Instructions:+ Understand User Queries: Carefully read and understand the+ user's question. Focus on keywords and context to+ determine the user's intent.+ Search for Relevant Information: Use the provided dataset+ and refer to the RAG (file to find answers that+ closely match the user's query. The RAG file+ contains detailed interactions and should be your+ primary resource for crafting responses.+ Provide Clear and Concise Responses: Your answers should+ be clear and to the point. Avoid overly technical+ language unless the user's query indicates+ familiarity with technical terms.+ Encourage Engagement: Where applicable, encourage users+ to contribute to the project or seek further+ assistance.++ Response Structure:+ Greeting: Begin with a polite greeting or acknowledgment.+ Main Response: Provide the main answer to the user's query.+ Additional Information: Offer any extra tips or direct the+ user to additional resources if necessary.+ Closing: Close the response politely, encouraging+ further engagement if appropriate.+ bd+ Tone:+ Professional: Maintain a professional tone that+ instills confidence in the user.+ Friendly: Be approachable and friendly to make users+ feel comfortable.+ Helpful: Always aim to be as helpful as possible,+ guiding users to solutions.+ '''self._agent = ChatAgent(- assistant_sys_msg,+ content,message_window_size=10,)@@ -132,10 +129,7 @@ class BotAgent:f"answer the query")- user_msg = BaseMessage.make_user_message(- role_name="User", content=user_raw_msg- )- assistant_response = self._agent.step(user_msg)+ assistant_response = self._agent.step(user_raw_msg)return assistant_response.msg.contentdiff --git a/examples/bots/slack_bot_use_msg_queue.py b/examples/bots/slack_bot_use_msg_queue.pyindex d974423b5..4e8b2bd12 100644--- a/examples/bots/slack_bot_use_msg_queue.py+++ b/examples/bots/slack_bot_use_msg_queue.py@@ -23,7 +23,6 @@ from slack_sdk.web.async_client import AsyncWebClientfrom camel.agents import ChatAgentfrom camel.bots import SlackApp, SlackEventBody-from camel.messages import BaseMessagefrom camel.retrievers import AutoRetrieverfrom camel.types import StorageType@@ -59,48 +58,46 @@ class BotAgent:return_detailed_info (bool): Whether to return detailedinformation from the retriever."""- assistant_sys_msg: BaseMessage = BaseMessage.make_assistant_message(- role_name="Assistant",- content='''- Objective:- You are a customer service bot designed to assist users- with inquiries related to our open-source project.- Your responses should be informative, concise, and helpful.-- Instructions:- Understand User Queries: Carefully read and understand the- user's question. Focus on keywords and context to- determine the user's intent.- Search for Relevant Information: Use the provided dataset- and refer to the RAG (file to find answers that- closely match the user's query. The RAG file- contains detailed interactions and should be your- primary resource for crafting responses.- Provide Clear and Concise Responses: Your answers should- be clear and to the point. Avoid overly technical- language unless the user's query indicates- familiarity with technical terms.- Encourage Engagement: Where applicable, encourage users- to contribute to the project or seek further- assistance.-- Response Structure:- Greeting: Begin with a polite greeting or acknowledgment.- Main Response: Provide the main answer to the user's query.- Additional Information: Offer any extra tips or direct the- user to additional resources if necessary.- Closing: Close the response politely, encouraging- further engagement if appropriate.- bd- Tone:- Professional: Maintain a professional tone that- instills confidence in the user.- Friendly: Be approachable and friendly to make users- feel comfortable.- Helpful: Always aim to be as helpful as possible,- guiding users to solutions.- ''',- )++ assistant_sys_msg = '''+ Objective:+ You are a customer service bot designed to assist users+ with inquiries related to our open-source project.+ Your responses should be informative, concise, and helpful.++ Instructions:+ Understand User Queries: Carefully read and understand the+ user's question. Focus on keywords and context to+ determine the user's intent.+ Search for Relevant Information: Use the provided dataset+ and refer to the RAG (file to find answers that+ closely match the user's query. The RAG file+ contains detailed interactions and should be your+ primary resource for crafting responses.+ Provide Clear and Concise Responses: Your answers should+ be clear and to the point. Avoid overly technical+ language unless the user's query indicates+ familiarity with technical terms.+ Encourage Engagement: Where applicable, encourage users+ to contribute to the project or seek further+ assistance.++ Response Structure:+ Greeting: Begin with a polite greeting or acknowledgment.+ Main Response: Provide the main answer to the user's query.+ Additional Information: Offer any extra tips or direct the+ user to additional resources if necessary.+ Closing: Close the response politely, encouraging+ further engagement if appropriate.+ bd+ Tone:+ Professional: Maintain a professional tone that+ instills confidence in the user.+ Friendly: Be approachable and friendly to make users+ feel comfortable.+ Helpful: Always aim to be as helpful as possible,+ guiding users to solutions.+ '''self._agent = ChatAgent(assistant_sys_msg,@@ -144,10 +141,7 @@ class BotAgent:f"answer the query")- user_msg = BaseMessage.make_user_message(- role_name="User", content=user_raw_msg- )- assistant_response = self._agent.step(user_msg)+ assistant_response = self._agent.step(user_raw_msg)return assistant_response.msg.contentdiff --git a/examples/code/generate_meta_data.py b/examples/code/generate_meta_data.pyindex cffad0be9..90b677a5b 100644--- a/examples/code/generate_meta_data.py+++ b/examples/code/generate_meta_data.py@@ -12,7 +12,6 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.prompts import PromptTemplateGeneratorfrom camel.types import TaskType@@ -23,18 +22,10 @@ def generate_meta_data(meta_data: str, num: int = 50, model=None):)prompt = prompt_template.format(**{f"num_{meta_data}": num})print(prompt)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",- )- agent = ChatAgent(assistant_sys_msg, model=model)+ agent = ChatAgent("You are a helpful assistant.", model=model)agent.reset()- user_msg = BaseMessage.make_user_message(- role_name="User",- content=prompt,- )- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)print(assistant_response.msg.content)diff --git a/examples/data_collector/alpaca_collector.py b/examples/data_collector/alpaca_collector.pyindex f408b88e1..ba32f66fe 100644--- a/examples/data_collector/alpaca_collector.py+++ b/examples/data_collector/alpaca_collector.py@@ -15,7 +15,6 @@from camel.agents.chat_agent import ChatAgentfrom camel.configs.openai_config import ChatGPTConfigfrom camel.data_collector import AlpacaDataCollector-from camel.messages.base import BaseMessagefrom camel.models.model_factory import ModelFactoryfrom camel.types.enums import ModelPlatformType, ModelType@@ -30,17 +29,11 @@ model = ModelFactory.create()agent = ChatAgent(- system_message=BaseMessage.make_assistant_message(- role_name="Tools calling operator",- content="You are a helpful assistant",- ),+ system_message="You are a helpful assistant",model=model,)-usr_msg = BaseMessage.make_user_message(- role_name="User",- content="When is the release date of the video game Portal?",-)+usr_msg = "When is the release date of the video game Portal?"collector = AlpacaDataCollector().record(agent).start()@@ -54,7 +47,7 @@ print(collector.llm_convert())collector.reset()# Manually record the message-collector.step("user", "Tools calling operator", usr_msg.content)+collector.step("user", "Tools calling operator", usr_msg)collector.step("assistant", "Tools calling operator", resp.msgs[0].content)diff --git a/examples/data_collector/sharegpt_collector.py b/examples/data_collector/sharegpt_collector.pyindex 17c72227c..5a12464dd 100644--- a/examples/data_collector/sharegpt_collector.py+++ b/examples/data_collector/sharegpt_collector.py@@ -17,7 +17,6 @@ import jsonfrom camel.agents import ChatAgentfrom camel.configs import ChatGPTConfigfrom camel.data_collector import ShareGPTDataCollector-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import MathToolkitfrom camel.types import ModelPlatformType, ModelType@@ -37,22 +36,14 @@ model = ModelFactory.create(# Set external_toolsagent = ChatAgent(- system_message=BaseMessage.make_assistant_message(- role_name="Tools calling operator",- content="You are a helpful assistant",- ),+ system_message="You are a helpful assistant",model=model,tools=tool_list,)collector = ShareGPTDataCollector().record(agent).start()-usr_msg = BaseMessage.make_user_message(- role_name="User",- content="Call tools to calculate 17 * 19 = ?",-)-# This will directly run the internal tool-response = agent.step(usr_msg)+response = agent.step("Call tools to calculate 17 * 19 = ?")print(json.dumps(collector.convert(), indent=4))diff --git a/examples/embodiment/code_execution.py b/examples/embodiment/code_execution.pyindex e5436a9a3..41958887e 100644--- a/examples/embodiment/code_execution.py+++ b/examples/embodiment/code_execution.py@@ -13,7 +13,6 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents import EmbodiedAgentfrom camel.generators import SystemMessageGenerator-from camel.messages import BaseMessagefrom camel.types import RoleType@@ -30,14 +29,12 @@ def main():verbose=True,)print(embodied_agent.system_message.content)- user_msg = BaseMessage.make_user_message(- role_name=role_name,- content=(- "Write a bash script to install numpy, "- "then write a python script to compute "- "the dot product of [6.75,3] and [4,5] and print the result, "- "then write a script to open a browser and search today's weather."- ),++ user_msg = (+ "Write a bash script to install numpy, "+ "then write a python script to compute "+ "the dot product of [6.75,3] and [4,5] and print the result, "+ "then write a script to open a browser and search today's weather.")response = embodied_agent.step(user_msg)print(response.msg.content)diff --git a/examples/embodiment/hugging_face_tool.py b/examples/embodiment/hugging_face_tool.pyindex 955bc3738..1c8018356 100644--- a/examples/embodiment/hugging_face_tool.py+++ b/examples/embodiment/hugging_face_tool.py@@ -16,7 +16,6 @@ from typing import Listfrom camel.agents import EmbodiedAgent, HuggingFaceToolAgentfrom camel.agents.tool_agents.base import BaseToolAgentfrom camel.generators import SystemMessageGenerator-from camel.messages import BaseMessagefrom camel.types import RoleType@@ -40,13 +39,11 @@ def main():verbose=True,tool_agents=tool_agents,)- user_msg = BaseMessage.make_user_message(- role_name=role_name,- content=(- "Draw all the Camelidae species, "- "caption the image content, "- "save the images by species name."- ),++ user_msg = (+ "Draw all the Camelidae species, "+ "caption the image content, "+ "save the images by species name.")response = embodied_agent.step(user_msg)print(response.msg.content)diff --git a/examples/evaluation/single_agent.py b/examples/evaluation/single_agent.pyindex 9712723c4..0dcb36c55 100644--- a/examples/evaluation/single_agent.py+++ b/examples/evaluation/single_agent.py@@ -17,7 +17,6 @@ import refrom typing import Any, Dict, Listfrom camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.prompts import PromptTemplateGeneratorfrom camel.types import TaskType@@ -56,15 +55,11 @@ def generate_questions(prompt = prompt_template.format(**evaluation_dict)print(prompt)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",- )- agent = ChatAgent(assistant_sys_msg, model=model)++ agent = ChatAgent("You are a helpful assistant.", model=model)agent.reset()- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)if len(assistant_response.msgs) > 0:print(assistant_response.msg.content)diff --git a/examples/external_tools/use_external_tools.py b/examples/external_tools/use_external_tools.pyindex 72ea6a0f9..3857ab6f1 100644--- a/examples/external_tools/use_external_tools.py+++ b/examples/external_tools/use_external_tools.py@@ -14,7 +14,6 @@from camel.agents import ChatAgentfrom camel.configs import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import MathToolkit, SearchToolkitfrom camel.types import ModelPlatformType, ModelType@@ -39,29 +38,20 @@ def main():# Set external_toolsexternal_tool_agent = ChatAgent(- system_message=BaseMessage.make_assistant_message(- role_name="Tools calling operator",- content="You are a helpful assistant",- ),+ system_message="You are a helpful assistant",model=model,tools=internal_tools,external_tools=external_tools,)- usr_msg = BaseMessage.make_user_message(- role_name="User",- content="When is the release date of the video game Portal?",- )-# This will directly run the internal tool- response = external_tool_agent.step(usr_msg)+ response = external_tool_agent.step(+ "When is the release date of the video game Portal?"+ )print(response.msg.content)- usr_msg = BaseMessage.make_user_message(- role_name="User",- content="What's the result of the release year of Portal subtracted by"- "the year that United States was founded?",- )+ usr_msg = "What's the result of the release year of Portal subtracted by"+ "the year that United States was founded?"# This will first automatically run the internal tool to check the years# Then it will request the external tool to calculate the sumresponse = external_tool_agent.step(usr_msg)diff --git a/examples/generate_text_embedding_data/single_agent.py b/examples/generate_text_embedding_data/single_agent.pyindex e575ad5c7..81213b21c 100644--- a/examples/generate_text_embedding_data/single_agent.py+++ b/examples/generate_text_embedding_data/single_agent.py@@ -18,7 +18,6 @@ import randomfrom camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfigfrom camel.generators import SystemMessageGenerator-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.types import (ModelPlatformType,@@ -62,9 +61,7 @@ def main() -> None:),role_tuple=("Text retrieval example writer:", RoleType.ASSISTANT),)- user_msg = BaseMessage.make_user_message(- role_name="User", content="Start to generate!"- )+model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,model_type=ModelType.DEFAULT,@@ -78,7 +75,7 @@ def main() -> None:model=model,)print(f"Generating positive and negative documents for '{task}'")- assistant_response = assistant_agent.step(user_msg)+ assistant_response = assistant_agent.step("Start to generate!")content = assistant_response.msg.contenttry:data = json.loads(content)diff --git a/examples/generate_text_embedding_data/task_generation.py b/examples/generate_text_embedding_data/task_generation.pyindex e420132b2..f4c54d9d6 100644--- a/examples/generate_text_embedding_data/task_generation.py+++ b/examples/generate_text_embedding_data/task_generation.py@@ -16,7 +16,6 @@ import osfrom camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfigfrom camel.generators import PromptTemplateGenerator-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.types import ModelPlatformType, ModelType, TaskType@@ -30,10 +29,6 @@ def main() -> None:evaluation_dict = dict(num_tasks=num_tasks)prompt = prompt_template.format(**evaluation_dict)print(prompt)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful text retrieval task generator.",- )model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,@@ -41,15 +36,14 @@ def main() -> None:model_config_dict=ChatGPTConfig(temperature=0.0).as_dict(),)agent = ChatAgent(- assistant_sys_msg,+ "You are a helpful text retrieval task generator.",model=model,)- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)total_tasks = []for _ in range(num_generate):agent.reset()- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)assistant_content = assistant_response.msg.content# Split tasks string to a list of tasks:tasks = assistant_content.split("\n")diff --git a/examples/misalignment/single_agent.py b/examples/misalignment/single_agent.pyindex 2a1628e20..245c5af94 100644--- a/examples/misalignment/single_agent.py+++ b/examples/misalignment/single_agent.py@@ -12,7 +12,6 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.prompts import PromptTemplateGeneratorfrom camel.types import TaskType@@ -25,15 +24,11 @@ def main(model=None) -> None:sys_prompt = PromptTemplateGenerator().get_prompt_from_key(TaskType.MISALIGNMENT, "dan_prompt")- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content=sys_prompt,- )- agent = ChatAgent(assistant_sys_msg, model=model)++ agent = ChatAgent(sys_prompt, model=model)agent.reset()- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)print(assistant_response.msg.content)diff --git a/examples/misalignment/task_generation.py b/examples/misalignment/task_generation.pyindex 1dba034a1..74f14f405 100644--- a/examples/misalignment/task_generation.py+++ b/examples/misalignment/task_generation.py@@ -20,7 +20,6 @@ from camel.generators import (RoleNameGenerator,SystemMessageGenerator,)-from camel.messages import BaseMessagefrom camel.prompts import PromptTemplateGeneratorfrom camel.types import RoleType, TaskType@@ -39,11 +38,7 @@ def generate_tasks()assistant_agent = ChatAgent(assistant_sys_msg)- user_msg = BaseMessage.make_user_message(- role_name="Task Generator", content=task_generator_prompt- )-- assistant_response = assistant_agent.step(user_msg)+ assistant_response = assistant_agent.step(task_generator_prompt)tasks = assistant_response.msg.content.split("\n")diff --git a/examples/runtime/code_execution_with_docker_runtime.py b/examples/runtime/code_execution_with_docker_runtime.pyindex abc5f1032..60279f143 100644--- a/examples/runtime/code_execution_with_docker_runtime.py+++ b/examples/runtime/code_execution_with_docker_runtime.py@@ -16,7 +16,6 @@ from colorama import Forefrom camel.agents import ChatAgentfrom camel.configs import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.runtime import DockerRuntimefrom camel.toolkits.code_execution import CodeExecutionToolkit@@ -49,13 +48,11 @@ model = ModelFactory.create(# set up agent-assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Teacher",- content=(- "You are a personal math tutor and programmer. "- "When asked a math question, "- "write and run Python code to answer the question."- ),++assistant_sys_msg = (+ "You are a personal math tutor and programmer. "+ "When asked a math question, "+ "write and run Python code to answer the question.")agent = ChatAgent(@@ -74,10 +71,9 @@ with runtime as r:"Weng earns $12 an hour for babysitting. ""Yesterday, she just did 51 minutes of babysitting. How much did she earn?")- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)print(Fore.YELLOW + f"user prompt:\n{prompt}\n")- response = agent.step(user_msg)+ response = agent.step(prompt)for msg in response.msgs:print_text_animated(Fore.GREEN + f"Agent response:\n{msg.content}\n")diff --git a/examples/runtime/code_execution_with_llm_guard_runtime.py b/examples/runtime/code_execution_with_llm_guard_runtime.pyindex c46215b96..70473ece5 100644--- a/examples/runtime/code_execution_with_llm_guard_runtime.py+++ b/examples/runtime/code_execution_with_llm_guard_runtime.py@@ -16,7 +16,6 @@ from colorama import Forefrom camel.agents import ChatAgentfrom camel.configs import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.runtime import LLMGuardRuntimefrom camel.toolkits.code_execution import CodeExecutionToolkit@@ -50,13 +49,11 @@ model = ModelFactory.create(# set up agent-assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Teacher",- content=(- "You are a personal math tutor and programmer. "- "When asked a math question, "- "write and run Python code to answer the question."- ),++assistant_sys_msg = (+ "You are a personal math tutor and programmer. "+ "When asked a math question, "+ "write and run Python code to answer the question.")agent = ChatAgent(@@ -73,10 +70,9 @@ prompt = ("Weng earns $12 an hour for babysitting. ""Yesterday, she just did 51 minutes of babysitting. How much did she earn?")-user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)print(Fore.YELLOW + f"user prompt:\n{prompt}\n")-response = agent.step(user_msg)+response = agent.step(prompt)for msg in response.msgs:print_text_animated(Fore.GREEN + f"Agent response:\n{msg.content}\n")diff --git a/examples/runtime/docker_runtime_with_tasks.py b/examples/runtime/docker_runtime_with_tasks.pyindex 6d60031ff..738ad1dc6 100644--- a/examples/runtime/docker_runtime_with_tasks.py+++ b/examples/runtime/docker_runtime_with_tasks.py@@ -16,7 +16,6 @@ from colorama import Forefrom camel.agents import ChatAgentfrom camel.configs import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.runtime import DockerRuntime, TaskConfigfrom camel.toolkits.code_execution import CodeExecutionToolkit@@ -56,14 +55,11 @@ model = ModelFactory.create(# set up agent-assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Teacher",- content=(- "You are a personal assistant and programmer. "- "When asked a question, "- "write and run Python code to answer the question."- "Your code will be executed using eval()."- ),+assistant_sys_msg = (+ "You are a personal assistant and programmer. "+ "When asked a question, "+ "write and run Python code to answer the question."+ "Your code will be executed using eval().")agent = ChatAgent(@@ -79,10 +75,9 @@ agent.reset()with runtime as r:r.wait()prompt = "List all directories in /home"- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)print(Fore.YELLOW + f"user prompt:\n{prompt}\n")- response = agent.step(user_msg)+ response = agent.step(prompt)for msg in response.msgs:print_text_animated(Fore.GREEN + f"Agent response:\n{msg.content}\n")diff --git a/examples/single_agent.py b/examples/single_agent.pyindex 619dfd675..f843be6c9 100644--- a/examples/single_agent.py+++ b/examples/single_agent.py@@ -12,7 +12,6 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.prompts import PromptTemplateGeneratorfrom camel.types import TaskType@@ -23,15 +22,10 @@ def main(key: str = 'generate_users', num_roles: int = 50, model=None):)prompt = prompt_template.format(num_roles=num_roles)print(prompt)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",- )- agent = ChatAgent(assistant_sys_msg, model=model)+ agent = ChatAgent("You are a helpful assistant.", model=model)agent.reset()- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)print(assistant_response.msg.content)diff --git a/examples/structured_response/json_format_reponse_with_tools.py b/examples/structured_response/json_format_reponse_with_tools.pyindex 405c7b649..61d2592ce 100644--- a/examples/structured_response/json_format_reponse_with_tools.py+++ b/examples/structured_response/json_format_reponse_with_tools.py@@ -16,7 +16,6 @@ from pydantic import BaseModel, Fieldfrom camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import (MathToolkit,@@ -33,10 +32,7 @@ assistant_model_config = ChatGPTConfig()# Define system message-assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",-)+assistant_sys_msg = "You are a helpful assistant."model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,@@ -60,12 +56,9 @@ class Schema(BaseModel):calculated_age: str = Field(description="the add more years of age")-user_msg = BaseMessage.make_user_message(- role_name="User",- content="Assume now is 2024 in the Gregorian calendar, "- + "estimate the current age of University of Oxford "- + "and then add 10 more years to this age, ",-)+user_msg = "Assume now is 2024 in the Gregorian calendar, "+"estimate the current age of University of Oxford "+"and then add 10 more years to this age, "# Get response informationresponse = camel_agent.step(user_msg, response_format=Schema)diff --git a/examples/structured_response/json_format_response.py b/examples/structured_response/json_format_response.pyindex a3dec1c0e..8ab741914 100644--- a/examples/structured_response/json_format_response.py+++ b/examples/structured_response/json_format_response.py@@ -15,15 +15,11 @@from pydantic import BaseModel, Fieldfrom camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.types import ModelPlatformType, ModelType# Define system message-assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",-)+assistant_sys_msg = "You are a helpful assistant."model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,@@ -40,13 +36,8 @@ class JokeResponse(BaseModel):funny_level: str = Field(description="Funny level, from 1 to 10")-user_msg = BaseMessage.make_user_message(- role_name="User",- content="Tell a jokes.",-)-# Get response information-response = camel_agent.step(user_msg, response_format=JokeResponse)+response = camel_agent.step("Tell me a joke.", response_format=JokeResponse)print(response.msgs[0].content)"""{'joke': "Why couldn't the bicycle find its way home? It lost its bearings!"diff --git a/examples/summarization/gpt_solution_extraction.py b/examples/summarization/gpt_solution_extraction.pyindex f1c6a9eb2..10c03607b 100644--- a/examples/summarization/gpt_solution_extraction.py+++ b/examples/summarization/gpt_solution_extraction.py@@ -22,7 +22,6 @@ from typing import Dict, Tupleimport numpy as npfrom camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.prompts import SolutionExtractionPromptTemplateDictfrom camel.types import RoleType@@ -130,18 +129,13 @@ def solution_extraction(solution_extraction_template = SolutionExtractionPromptTemplateDict()assistant_sys_msg_prompt = solution_extraction_template[RoleType.ASSISTANT]- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Solution Extractor", content=assistant_sys_msg_prompt- )-# We use GPT4 because it has a longer context length- agent = ChatAgent(assistant_sys_msg)+ agent = ChatAgent(assistant_sys_msg_prompt)agent.reset()prompt = "Here is the conversation:" + flattened_conversation- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)print(assistant_response.msg.content)# Create folder to write solution_extraction todiff --git a/examples/summarization/gpt_solver.py b/examples/summarization/gpt_solver.pyindex 3accd21a4..e19069f32 100644--- a/examples/summarization/gpt_solver.py+++ b/examples/summarization/gpt_solver.py@@ -17,7 +17,6 @@ import osfrom typing import Dictfrom camel.agents import ChatAgent-from camel.messages import BaseMessage# Directory containing your json files of CAMEL conversations# This code will append a new key called "gpt_solution" to each json file@@ -30,16 +29,12 @@ save_dir = "./camel_data/ai_society_solution_extraction_save"def process_file(data: Dict[str, str]) -> None:print(data["id"])- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful assistant.",- )+ assistant_sys_msg = "You are a helpful assistant."agent = ChatAgent(assistant_sys_msg)agent.reset()prompt = "Solve the following task:\n" + data["specified_task"]- user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)- assistant_response = agent.step(user_msg)+ assistant_response = agent.step(prompt)print(assistant_response.msg.content)# Append solution to JSON file as "gpt_solution"diff --git a/examples/tasks/task_generation.py b/examples/tasks/task_generation.pyindex f7f480b50..6176552d4 100644--- a/examples/tasks/task_generation.py+++ b/examples/tasks/task_generation.py@@ -14,7 +14,6 @@from camel.agents import ChatAgentfrom camel.configs import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.tasks import (Task,@@ -37,10 +36,7 @@ model = ModelFactory.create()# set up agent-assistant_sys_msg = BaseMessage.make_user_message(- role_name="Teacher",- content=("You are a personal math tutor and programmer."),-)+assistant_sys_msg = "You are a personal math tutor and programmer."agent = ChatAgent(assistant_sys_msg, model)agent.reset()diff --git a/examples/toolkits/arxiv_toolkit.py b/examples/toolkits/arxiv_toolkit.pyindex 57e2ba99f..1b8bbcee5 100644--- a/examples/toolkits/arxiv_toolkit.py+++ b/examples/toolkits/arxiv_toolkit.py@@ -14,15 +14,12 @@from camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import ArxivToolkitfrom camel.types import ModelPlatformType, ModelType# Define system message-sys_msg = BaseMessage.make_assistant_message(- role_name='Tools calling opertor', content='You are a helpful assistant'-)+sys_msg = "You are a helpful assistant"# Set model configtools = ArxivToolkit().get_tools()@@ -45,10 +42,7 @@ camel_agent = ChatAgent(camel_agent.reset()# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="""Search paper 'attention is all you need' for me""",-)+usr_msg = "Search paper 'attention is all you need' for me"# Get response informationresponse = camel_agent.step(usr_msg)@@ -74,11 +68,8 @@ performance ove...# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="""Download paper "attention is all you need" for me to my- local path '/Users/enrei/Desktop/camel0826/camel/examples/tool_call'""",-)+usr_msg = """Download paper "attention is all you need" for me to my+ local path '/Users/enrei/Desktop/camel0826/camel/examples/tool_call'"""# Get response informationresponse = camel_agent.step(usr_msg)diff --git a/examples/toolkits/code_execution_toolkit.py b/examples/toolkits/code_execution_toolkit.pyindex 696727dbb..cbb2652ec 100644--- a/examples/toolkits/code_execution_toolkit.py+++ b/examples/toolkits/code_execution_toolkit.py@@ -16,7 +16,6 @@ from colorama import Forefrom camel.agents import ChatAgentfrom camel.configs import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits.code_execution import CodeExecutionToolkitfrom camel.types import ModelPlatformType, ModelType@@ -39,13 +38,10 @@ model = ModelFactory.create(# set up agent-assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Teacher",- content=(- "You are a personal math tutor and programmer. "- "When asked a math question, "- "write and run Python code to answer the question."- ),+assistant_sys_msg = (+ "You are a personal math tutor and programmer. "+ "When asked a math question, "+ "write and run Python code to answer the question.")agent = ChatAgent(@@ -62,10 +58,9 @@ prompt = ("Weng earns $12 an hour for babysitting. ""Yesterday, she just did 51 minutes of babysitting. How much did she earn?")-user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)print(Fore.YELLOW + f"user prompt:\n{prompt}\n")-response = agent.step(user_msg)+response = agent.step(prompt)for msg in response.msgs:print_text_animated(Fore.GREEN + f"Agent response:\n{msg.content}\n")@@ -98,7 +93,7 @@ agent_with_e2b.reset()print(Fore.YELLOW + f"user prompt:\n{prompt}\n")-response_with_e2b = agent_with_e2b.step(user_msg)+response_with_e2b = agent_with_e2b.step(prompt)for msg in response_with_e2b.msgs:print_text_animated(Fore.GREEN + f"Agent response:\n{msg.content}\n")diff --git a/examples/toolkits/google_scholar_toolkit.py b/examples/toolkits/google_scholar_toolkit.pyindex 75137d6fc..3e36f3e70 100644--- a/examples/toolkits/google_scholar_toolkit.py+++ b/examples/toolkits/google_scholar_toolkit.py@@ -14,15 +14,12 @@from camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import GoogleScholarToolkitfrom camel.types import ModelPlatformType, ModelType# Define system message-sys_msg = BaseMessage.make_assistant_message(- role_name="Tools calling opertor", content="You are a helpful assistant"-)+sys_msg = "You are a helpful assistant"# Set model configtools = GoogleScholarToolkit(@@ -48,10 +45,7 @@ camel_agent = ChatAgent(camel_agent.reset()# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="get the detailed information of this author",-)+usr_msg = "get the detailed information of this author"# Get response informationresponse = camel_agent.step(usr_msg)@@ -89,9 +83,7 @@ DeepMind'}, {'container_type': 'Author', 'filled': [], 'scholar_id':"""# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User", content="get the publications of this author"-)+usr_msg = "get the publications of this author"# Get response informationresponse = camel_agent.step(usr_msg)@@ -117,10 +109,8 @@ detectors', 'Lec# ruff: noqa: E501# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="""get the detailed information for publication with title: `Camel: Communicative agents for" mind" exploration of large language model society`""",-)++usr_msg = """get the detailed information for publication with title: `Camel: Communicative agents for" mind" exploration of large language model society`"""# Get response informationresponse = camel_agent.step(usr_msg)@@ -165,10 +155,7 @@ google.com/', 'cites_per_year': {2023: 95, 2024: 269}})]==============================================================================="""-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="""get the full information for paper from link: `https://hal.science/hal-04206682/document`""",-)+usr_msg = """get the full information for paper from link: `https://hal.science/hal-04206682/document`"""# Get response informationresponse = camel_agent.step(usr_msg)diff --git a/examples/toolkits/notion_toolkit.py b/examples/toolkits/notion_toolkit.pyindex a59451b64..e4e7fc8f5 100644--- a/examples/toolkits/notion_toolkit.py+++ b/examples/toolkits/notion_toolkit.py@@ -14,15 +14,12 @@from camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import NotionToolkitfrom camel.types import ModelPlatformType, ModelType# Define system message-sys_msg = BaseMessage.make_assistant_message(- role_name="Tools calling opertor", content="You are a helpful assistant"-)+sys_msg = "You are a helpful assistant"# Set model configtools = NotionToolkit().get_tools()@@ -45,10 +42,7 @@ camel_agent = ChatAgent(camel_agent.reset()# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="Lists all pages in the Notion workspace",-)+usr_msg = "Lists all pages in the Notion workspace"# Get response informationresponse = camel_agent.step(usr_msg)@@ -60,11 +54,8 @@ print(str(response.info['tool_calls'])[:1000]){'id': '47a4fb54-e34b-4b45-9928-aa2802982eb8', 'title': 'Aigentbot'}])]"""-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="Retrieves the text content of a Notion block which id is"- + "'12684f56-4caa-8080-be91-d7fb1a5834e3'",-)+usr_msg = "Retrieves the text content of a Notion block which id is"+"'12684f56-4caa-8080-be91-d7fb1a5834e3'"# Get response informationresponse = camel_agent.step(usr_msg)@@ -82,10 +73,7 @@ animals%2Fmammals%2Ffacts%2Fdomestic-cat&docid=K6Qd9XWnQFQCoM&tbnid=eAP242&hcb=2&ved=2ahUKEwir9rf3oKGJAxVsFTQIHYsrMYkQM3oECBkQAA')]"""-usr_msg = BaseMessage.make_user_message(- role_name="CAMEL User",- content="List names of users via the Notion integration",-)+usr_msg = "List names of users via the Notion integration"# Get response informationresponse = camel_agent.step(usr_msg)diff --git a/examples/toolkits/openapi_toolkit.py b/examples/toolkits/openapi_toolkit.pyindex bfb13477e..2e4dc1009 100644--- a/examples/toolkits/openapi_toolkit.py+++ b/examples/toolkits/openapi_toolkit.py@@ -13,15 +13,12 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents import ChatAgentfrom camel.configs.openai_config import ChatGPTConfig-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.toolkits import OpenAPIToolkitfrom camel.types import ModelPlatformType, ModelType# Define system message-sys_msg = BaseMessage.make_assistant_message(- role_name='Tools calling opertor', content='You are a helpful assistant'-)+sys_msg = "You are a helpful assistant"# Set model configtools = OpenAPIToolkit().get_tools()@@ -44,9 +41,7 @@ camel_agent = ChatAgent(camel_agent.reset()# Define a user message-usr_msg = BaseMessage.make_user_message(- role_name='CAMEL User', content='help me to select a basketball in klarna.'-)+usr_msg = "help me to select a basketball in klarna."# Get response informationresponse = camel_agent.step(usr_msg)diff --git a/examples/toolkits/post_weather_on_twitter.py b/examples/toolkits/post_weather_on_twitter.pyindex de54ba05c..380c836d7 100644--- a/examples/toolkits/post_weather_on_twitter.py+++ b/examples/toolkits/post_weather_on_twitter.py@@ -14,7 +14,6 @@from colorama import Forefrom camel.agents import ChatAgent-from camel.messages import BaseMessagefrom camel.toolkits import SearchToolkit, TwitterToolkit, WeatherToolkitfrom camel.utils import print_text_animated@@ -31,10 +30,7 @@ def main():- SEARCH_ENGINE_ID"""- sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content="You are a helpful agent with multiple tools.",- )+ sys_msg = "You are a helpful agent with multiple tools."agent = ChatAgent(system_message=sys_msg,@@ -45,12 +41,9 @@ def main():],)- usr_msg = BaseMessage.make_user_message(- role_name="User",- content="I'm in Chicago and want to travel to Oxford today. Make a "- "travel plan for me, considering the weather today. Also announce my "- "plan on Twitter from my perspective.",- )+ usr_msg = "I'm in Chicago and want to travel to Oxford today. Make a "+ "travel plan for me, considering the weather today. Also announce my "+ "plan on Twitter from my perspective."response = agent.step(usr_msg)diff --git a/examples/translation/translator.py b/examples/translation/translator.pyindex 47667a746..7d840691a 100644--- a/examples/translation/translator.py+++ b/examples/translation/translator.py@@ -22,7 +22,6 @@ import warningsfrom camel.agents import ChatAgentfrom camel.configs import ChatGPTConfigfrom camel.generators import SystemMessageGenerator-from camel.messages import BaseMessagefrom camel.models import ModelFactoryfrom camel.types import (ModelPlatformType,@@ -134,9 +133,7 @@ def translate_content(model=model,)- user_msg = BaseMessage.make_user_message(- role_name="Language Translator", content=msg_i_content- )+ user_msg = msg_i_contentassistant_response = assistant_agent.step(user_msg)assistant_msg = assistant_response.msgdiff --git a/examples/vision/image_crafting.py b/examples/vision/image_crafting.pyindex de9d82ab4..a9eae3fd9 100644--- a/examples/vision/image_crafting.py+++ b/examples/vision/image_crafting.py@@ -12,7 +12,6 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========from camel.agents.chat_agent import ChatAgent-from camel.messages.base import BaseMessagefrom camel.models import ModelFactoryfrom camel.prompts import PromptTemplateGeneratorfrom camel.toolkits import DalleToolkit@@ -32,28 +31,18 @@ def main():print(sys_msg)print("=" * 49)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Artist",- content=sys_msg,- )-- user_msg = BaseMessage.make_user_message(- role_name="User",- content="Draw a picture of a camel.",- )-model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,model_type=ModelType.DEFAULT,)dalle_agent = ChatAgent(- system_message=assistant_sys_msg,+ system_message=sys_msg,model=model,tools=DalleToolkit().get_tools(),)- response = dalle_agent.step(user_msg)+ response = dalle_agent.step("Draw a picture of a camel.")print("=" * 20 + " RESULT " + "=" * 20)print(response.msg.content)diff --git a/examples/vision/multi_condition_image_crafting.py b/examples/vision/multi_condition_image_crafting.pyindex 7e9e10016..6e541710e 100644--- a/examples/vision/multi_condition_image_crafting.py+++ b/examples/vision/multi_condition_image_crafting.py@@ -34,18 +34,13 @@ def main(image_paths: list[str]) -> list[str]:print(sys_msg)print("=" * 49)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Artist",- content=sys_msg,- )-model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,model_type=ModelType.DEFAULT,)dalle_agent = ChatAgent(- system_message=assistant_sys_msg,+ system_message=sys_msg,model=model,tools=DalleToolkit().get_tools(),)diff --git a/examples/vision/multi_turn_image_refining.py b/examples/vision/multi_turn_image_refining.pyindex ac0bf6562..f96599157 100644--- a/examples/vision/multi_turn_image_refining.py+++ b/examples/vision/multi_turn_image_refining.py@@ -53,7 +53,7 @@ CRITICS: the image needs to improve...PROMPT: here is the updated prompt!"""self.critic_sys_msg = BaseMessage.make_assistant_message(- role_name='critic', content=critic_sys+ role_name='Critic', content=critic_sys)self.artist_sys_msg = BaseMessage.make_assistant_message(diff --git a/examples/vision/object_recognition.py b/examples/vision/object_recognition.pyindex e02b35a85..c1c489f5c 100644--- a/examples/vision/object_recognition.py+++ b/examples/vision/object_recognition.py@@ -46,16 +46,12 @@ def detect_image_obj(image_paths: str) -> None:print(sys_msg)print("=" * 49)- assistant_sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content=sys_msg,- )model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,model_type=ModelType.DEFAULT,)agent = ChatAgent(- assistant_sys_msg,+ sys_msg,model=model,)image_list = [Image.open(image_path) for image_path in image_paths]diff --git a/examples/vision/video_description.py b/examples/vision/video_description.pyindex fa6296ee8..69f543d78 100644--- a/examples/vision/video_description.py+++ b/examples/vision/video_description.py@@ -23,10 +23,6 @@ from camel.types.enums import RoleType, TaskTypesys_msg_prompt = PromptTemplateGenerator().get_prompt_from_key(TaskType.VIDEO_DESCRIPTION, RoleType.ASSISTANT)-sys_msg = BaseMessage.make_assistant_message(- role_name="Assistant",- content=sys_msg_prompt,-)model = ModelFactory.create(model_platform=ModelPlatformType.DEFAULT,@@ -34,7 +30,7 @@ model = ModelFactory.create()# Set agent-camel_agent = ChatAgent(sys_msg, model=model)+camel_agent = ChatAgent(sys_msg_prompt, model=model)# The video from YouTube can be found at the following link:# https://www.youtube.com/watch?v=kQ_7GtE529Mdiff --git a/test/bots/test_telegram_bot.py b/test/bots/test_telegram_bot.pyindex 465ad8379..6caa0b168 100644--- a/test/bots/test_telegram_bot.py+++ b/test/bots/test_telegram_bot.py@@ -16,7 +16,6 @@ from unittest.mock import MagicMock, patchfrom camel.agents import ChatAgentfrom camel.bots.telegram_bot import TelegramBot-from camel.messages import BaseMessageclass TestTelegramBot(unittest.TestCase):@@ -41,9 +40,7 @@ class TestTelegramBot(unittest.TestCase):message_mock = MagicMock()message_mock.text = "Hello, world!"- user_msg_mock = BaseMessage.make_user_message(- "User", content="Hello, world!"- )+ user_msg_mock = "Hello, world!"response_msg_mock = MagicMock(msg=MagicMock(content="Hello back!"))self.chat_agent_mock.reset = MagicMock()