🐫 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
Modify demo (#19)
Guohao Li0494f05b6ac7
diff --git a/examples/role_playing.py b/examples/role_playing.pyindex 0274b40fa..b64ee12c8 100644--- a/examples/role_playing.py+++ b/examples/role_playing.py@@ -1,8 +1,16 @@+import time+from camel.agent import RolePlaying+def print_text_animated(text):+ for char in text:+ print(char, end="", flush=True)+ time.sleep(0.02)++def main() -> None:- task_prompt = "Developing custom game mods or plugins"+ task_prompt = "Design a custom game using PyGame"print(f"Original task prompt:\n{task_prompt}\n")role_play_session = RolePlaying("Computer Programer", "Gamer", task_prompt)print(f"Specified task prompt:\n{role_play_session.task_prompt}\n")@@ -12,8 +20,12 @@ def main() -> None:while n < chat_turn_limit:n += 1assistant_msg, user_msg = role_play_session.step(assistant_msg)- print(f"AI User:\n\n{user_msg.content}\n\n")- print(f"AI Assistant:\n\n{assistant_msg.content}\n\n")+ print_text_animated(f"AI User:\n\n{user_msg.content}\n\n")+ time.sleep(0.5)+ print_text_animated(f"AI Assistant:\n\n{assistant_msg.content}\n\n")++ if "<CAMEL_TASK_DONE>" in assistant_msg.content:+ breakif __name__ == "__main__":