🐫 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: revert change to `ChatAgent` and test for example (#664)
Wendong-Fan4286bc2d3536
diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.pyindex 2951c5ac4..db04856e4 100644--- a/camel/agents/chat_agent.py+++ b/camel/agents/chat_agent.py@@ -522,19 +522,11 @@ class ChatAgent(BaseAgent):"""output_messages: List[BaseMessage] = []for choice in response.choices:- if isinstance(choice.message, list):- # If choice.message is a list, handle accordingly- # It's a check to fit with Nemotron model integration.- content = "".join(- [msg.content for msg in choice.message if msg.content]- )- else:- content = choice.message.content or ""chat_message = BaseMessage(role_name=self.role_name,role_type=self.role_type,meta_dict=dict(),- content=content,+ content=choice.message.content or "",)output_messages.append(chat_message)finish_reasons = [diff --git a/examples/test/test_role_description_example.py b/examples/test/test_role_description_example.pyindex 86b9d3b12..fb94dc94c 100644--- a/examples/test/test_role_description_example.py+++ b/examples/test/test_role_description_example.py@@ -18,20 +18,26 @@ import examples.role_description.role_playing_with_role_descriptionfrom camel.models import ModelFactoryfrom camel.types import ModelPlatformType, ModelType-model = ModelFactory.create(+model_gpt = ModelFactory.create(ModelPlatformType.OPENAI,model_type=ModelType.GPT_3_5_TURBO,model_config_dict={},)+model_stub = ModelFactory.create(+ ModelPlatformType.OPENAI,+ model_type=ModelType.STUB,+ model_config_dict={},+)+def test_role_generation_example():with patch('time.sleep', return_value=None):- examples.role_description.role_generation.main(model)+ examples.role_description.role_generation.main(model_gpt)def test_role_playing_with_role_description_example():with patch('time.sleep', return_value=None):examples.role_description.role_playing_with_role_description.main(- model, model, chat_turn_limit=2+ model_gpt, model_stub, chat_turn_limit=2)diff --git a/examples/test/test_single_agent.py b/examples/test/test_single_agent.pyindex 6b303e8f7..bb5677acc 100644--- a/examples/test/test_single_agent.py+++ b/examples/test/test_single_agent.py@@ -39,7 +39,16 @@ def test_single_agent(model):examples.single_agent.main(model=model)-@parametrize+ 'model',+ [+ ModelFactory.create(+ ModelPlatformType.OPENAI,+ model_type=ModelType.STUB,+ model_config_dict={},+ )+ ],+)def test_misalignment_single_agent(model):examples.misalignment.single_agent.main(model=model)@@ -54,6 +63,15 @@ def test_code_generate_metadata(model):examples.code.generate_meta_data.main(model=model)-@parametrize+ 'model',+ [+ ModelFactory.create(+ ModelPlatformType.OPENAI,+ model_type=ModelType.STUB,+ model_config_dict={},+ )+ ],+)def test_code_task_generation(model):examples.code.task_generation.main(model=model)