diff --git a/examples/environments/chatroom/chatroom_with_assistant_example.py b/examples/environments/chatroom/chatroom_with_assistant_example.py index 599c34947..13dbbf1d5 100644 --- a/examples/environments/chatroom/chatroom_with_assistant_example.py +++ b/examples/environments/chatroom/chatroom_with_assistant_example.py @@ -187,7 +187,11 @@ def main(args: argparse.Namespace) -> None: carol.join(r) # Start the chat - r.chatting(delay={carol.agent_id: 0, bob.agent_id: 5}) + r.chat_freely( + delay=10, + interval=10, + max_round=10, + ) if __name__ == "__main__": diff --git a/examples/environments/chatroom/envs/chatroom.py b/examples/environments/chatroom/envs/chatroom.py index 430fc15c3..a17b34119 100644 --- a/examples/environments/chatroom/envs/chatroom.py +++ b/examples/environments/chatroom/envs/chatroom.py @@ -168,7 +168,9 @@ def get_history(self, agent_name: str) -> List[Msg]: def describe(self, agent_name: str, **kwargs: Any) -> str: """Get the description of the chatroom.""" - ann = self.announcement if self.announcement else "EMPTY" + ann = ( + self.announcement.content if self.announcement.content else "EMPTY" + ) history = "\n\n".join( [ f"{msg.name}: {msg.content}" @@ -265,10 +267,10 @@ def chat_freely( task.join() def chat_in_sequence(self, agent_name_order: List[str] = None) -> None: - """Let all agents to chat in a sequence + """Let all agents chat in sequence Args: - sequence (`List[str]`): Order of speakers' names. + agent_name_order (`List[str]`): Order of speakers' names. """ for agent_name in agent_name_order: self.children[agent_name].chat() @@ -361,9 +363,8 @@ def _want_to_speak(self, hint: str) -> bool: prompt, max_retries=3, ).text - speak = "yes" in response.lower() - logger.debug(f"[SPEAK OR NOT] {self.name}: {response}") - return speak + logger.info(f"[SPEAK OR NOT] {self.name}: {response}") + return "yes" in response.lower() def speak( self,