class_docstr: (In preview) A chat manager agent that can manage a group chat of multiple agents.
class_docstr_tok: ["(","In","preview",")","A","chat","manager","agent","that","can","manage","a","group","chat","of","multiple","agents","."]
docstr: Run a group chat.
docstr_tok: ["Run","a","group","chat","."]
code: def run_chat(
      self,
      messages: Optional[List[Dict]] = None,
      sender: Optional[Agent] = None,
      config: Optional[GroupChat] = None,
  ) -> Union[str, Dict, None]:
      """Run a group chat."""
      if messages is None:
          messages = self._oai_messages[sender]
      message = messages[-1]
      speaker = sender
      groupchat = config
      for i in range(groupchat.max_round):
          groupchat.append(message, speaker)
          if self._is_termination_msg(message):
              # The conversation is over
              break
          # broadcast the message to all agents except the speaker
          for agent in groupchat.agents:
              if agent != speaker:
                  self.send(
                      message, agent, request_reply=False, silent=True
                  )
          if i == groupchat.max_round - 1:
              # the last round
              break
          try:
              # select the next speaker
              speaker = groupchat.select_speaker(speaker, self)
              # let the speaker speak
              reply = speaker.generate_reply(sender=self)
          except KeyboardInterrupt:
              # let the admin agent speak if interrupted
              if groupchat.admin_name in groupchat.agent_names:
                  # admin agent is one of the participants
                  speaker = groupchat.agent_by_name(
                      groupchat.admin_name
                  )
                  reply = speaker.generate_reply(sender=self)
              else:
                  # admin agent is not found in the participants
                  raise
          if reply is None:
              break
          # The speaker sends the message without requesting a reply
          speaker.send(reply, self, request_reply=False)
          message = self.last_message(speaker)
          if i == groupchat.max_round - 1:
              groupchat.append(message, speaker)
      return True, None
  
imports: import logging
  import random
  import re
  import sys
  from dataclasses import dataclass
  from typing import Dict, List, Optional, Union, Tuple
  from ..code_utils import content_str
  from .agent import Agent
  from .conversable_agent import ConversableAgent
label_desc: Use image node_id 2 for calling the GroupChatManager obj's underlying member method code with example usage: obj.run_chat(messages, sender, config) and returns: True,  None