🐫 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
Test role playing role-at-backend sequence (#302)
Zhiyu Wanga37d5f50a4f5
diff --git a/test/agents/test_role_playing.py b/test/agents/test_role_playing.pyindex 390a74f8f..d2406026c 100644--- a/test/agents/test_role_playing.py+++ b/test/agents/test_role_playing.py@@ -146,3 +146,33 @@ def test_role_playing_with_function():assert isinstance(response.terminated, bool)assert response.terminated is Falseassert isinstance(response.info, dict)+++def test_role_playing_role_sequence(model_type=None):+ task_prompt = "Develop a trading bot for the stock market"+ role_playing = RolePlaying(+ assistant_role_name="Python Programmer",+ assistant_agent_kwargs=dict(model=model_type),+ user_role_name="Stock Trader",+ user_agent_kwargs=dict(model=model_type),+ task_prompt=task_prompt,+ with_task_specify=True,+ task_specify_agent_kwargs=dict(model=model_type),+ )+ assistant_role_sequence = []+ user_role_sequence = []++ input_assistant_msg, _ = role_playing.init_chat()+ assistant_response, user_response = role_playing.step(input_assistant_msg)+ input_assistant_msg = assistant_response.msg+ assistant_response, user_response = role_playing.step(input_assistant_msg)++ for record in role_playing.user_agent.stored_messages:+ user_role_sequence.append(record.role_at_backend)+ for record in role_playing.assistant_agent.stored_messages:+ assistant_role_sequence.append(record.role_at_backend)++ assert user_role_sequence == \+ ['system', 'user', 'assistant', 'user', 'assistant']+ assert assistant_role_sequence == \+ ['system', 'user', 'user', 'assistant', 'user', 'assistant']