Traceback (most recent call last):
File "/Users/jonchui/code/chatgpt/camel/camelMe.py", line 37, in <module>
main(args.prompt, args.assistant, args.user)
File "/Users/jonchui/code/chatgpt/camel/camelMe.py", line 24, in main
(assistant_msg, _, _), (user_msg, _, _) = role_play_session.step(assistant_msg)
File "/Users/jonchui/code/chatgpt/camel/camel/agents/role_playing.py", line 113, in step
raise RuntimeError("User agent is terminated.")
RuntimeError: User agent is terminated.
I'm going to see if CAMEL can fix itself ;)
#!/usr/bin/env python
import os
import openai
openai.api_key = "[REDACTED]"
import time
from colorama import Fore
def print_text_animated(text):
for char in text:
print(char, end="", flush=True)
#time.sleep(0.02)
from camel.agents import RolePlaying
task_prompt = '''
DEBUG and fix this error that keeps happening when I try to run the code:
RuntimeError("User agent is terminated.")
Traceback (most recent call last):
File "/Users/jonchui/code/chatgpt/camel/camelMe.py", line 37, in
main(args.prompt, args.assistant, args.user)
File "/Users/jonchui/code/chatgpt/camel/camelMe.py", line 24, in main
(assistant_msg, _, _), (user_msg, _, _) = role_play_session.step(assistant_msg)
File "/Users/jonchui/code/chatgpt/camel/camel/agents/role_playing.py", line 113, in step
raise RuntimeError("User agent is terminated.")
RuntimeError: User agent is terminated.
def step(
self,
assistant_msg: ChatMessage,
) -> Tuple[Tuple[ChatMessage, bool, Dict], Tuple[ChatMessage, bool, Dict]]:
user_msgs, user_terminated, user_info = self.user_agent.step(
assistant_msg)
if user_terminated:
raise RuntimeError("User agent is terminated.")
user_msg = user_msgs[0]
user_msg.role = "user"
(assistant_msgs, assistant_terminated,
assistant_info) = self.assistant_agent.step(user_msg)
if assistant_terminated:
raise RuntimeError("Assistant agent is terminated.")
assistant_msg = assistant_msgs[0]
assistant_msg.role = "user"
return (
(assistant_msg, assistant_terminated, assistant_info),
(user_msg, user_terminated, user_info),
)
the github project is here:
https://github.com/lightaime/camel
'''
print(Fore.YELLOW + f"Original task prompt:\n{task_prompt}\n")
role_play_session = RolePlaying("Computer Programmer", "Software Engineer", task_prompt)
print(Fore.CYAN + f"Specified task prompt:\n{role_play_session.task_prompt}\n")
chat_turn_limit, n = 1000, 0
assistant_msg, _ = role_play_session.init_chat()
while n < chat_turn_limit:
n += 1
(assistant_msg, _, _), (user_msg, _, _) = role_play_session.step(assistant_msg)
print_text_animated(Fore.BLUE + f"AI User:\n\n{user_msg.content}\n\n")
print_text_animated(Fore.GREEN + f"AI Assistant:\n\n{assistant_msg.content}\n\n")
if "<CAMEL_TASK_DONE>" in user_msg.content:
break