GroupChat - AG2

GroupChat

autogen.GroupChat dataclass

GroupChat(agents, messages=list(), max_round=10, admin_name='Admin', func_call_filter=True, speaker_selection_method='auto', max_retries_for_selecting_speaker=2, allow_repeat_speaker=None, allowed_or_disallowed_speaker_transitions=None, speaker_transitions_type=None, enable_clear_history=False, send_introductions=False, select_speaker_message_template='You are in a role play game. The following roles are available:\n                {roles}.\n                Read the following conversation.\n                Then select the next role from {agentlist} to play. Only return the role.', select_speaker_prompt_template=SELECT_SPEAKER_PROMPT_TEMPLATE, select_speaker_auto_multiple_template='You provided more than one name in your text, please return just the name of the next speaker. To determine the speaker use these prioritised rules:\n    1. If the context refers to themselves as a speaker e.g. "As the..." , choose that speaker's name\n    2. If it refers to the "next" speaker name, choose that name\n    3. Otherwise, choose the first provided speaker's name in the context\n    The names are case-sensitive and should not be abbreviated or changed.\n    Respond with ONLY the name of the speaker and DO NOT provide a reason.', select_speaker_auto_none_template='You didn\'t choose a speaker. As a reminder, to determine the speaker use these prioritised rules:\n    1. If the context refers to themselves as a speaker e.g. "As the..." , choose that speaker's name\n    2. If it refers to the "next" speaker name, choose that name\n    3. Otherwise, choose the first provided speaker's name in the context\n    The names are case-sensitive and should not be abbreviated or changed.\n    The only names that are accepted are {agentlist}.\n    Respond with ONLY the name of the speaker and DO NOT provide a reason.', select_speaker_transform_messages=None, select_speaker_auto_verbose=False, select_speaker_auto_model_client_cls=None, select_speaker_auto_llm_config=None, role_for_select_speaker_messages='system', eligibility_policies=list())

A group chat class that contains the following data fields:

agents instance-attribute

agents

messages class-attribute instance-attribute

messages = field(default_factory=list)

max_round class-attribute instance-attribute

max_round = 10

admin_name class-attribute instance-attribute

admin_name = 'Admin'

func_call_filter class-attribute instance-attribute

func_call_filter = True

speaker_selection_method class-attribute instance-attribute

speaker_selection_method = 'auto'

max_retries_for_selecting_speaker class-attribute instance-attribute

max_retries_for_selecting_speaker = 2

allow_repeat_speaker class-attribute instance-attribute

allow_repeat_speaker = None

allowed_or_disallowed_speaker_transitions class-attribute instance-attribute

allowed_or_disallowed_speaker_transitions = None

speaker_transitions_type class-attribute instance-attribute

speaker_transitions_type = None

enable_clear_history class-attribute instance-attribute

enable_clear_history = False

send_introductions class-attribute instance-attribute

send_introductions = False

select_speaker_message_template class-attribute instance-attribute

select_speaker_message_template = 'You are in a role play game. The following roles are available:\n                {roles}.\n                Read the following conversation.\n                Then select the next role from {agentlist} to play. Only return the role.'

select_speaker_prompt_template class-attribute instance-attribute

select_speaker_prompt_template = SELECT_SPEAKER_PROMPT_TEMPLATE

select_speaker_auto_multiple_template class-attribute instance-attribute

select_speaker_auto_multiple_template = 'You provided more than one name in your text, please return just the name of the next speaker. To determine the speaker use these prioritised rules:\n    1. If the context refers to themselves as a speaker e.g. "As the..." , choose that speaker's name\n    2. If it refers to the "next" speaker name, choose that name\n    3. Otherwise, choose the first provided speaker's name in the context\n    The names are case-sensitive and should not be abbreviated or changed.\n    Respond with ONLY the name of the speaker and DO NOT provide a reason.'

select_speaker_auto_none_template class-attribute instance-attribute

select_speaker_auto_none_template = 'You didn\'t choose a speaker. As a reminder, to determine the speaker use these prioritised rules:\n    1. If the context refers to themselves as a speaker e.g. "As the..." , choose that speaker's name\n    2. If it refers to the "next" speaker name, choose that name\n    3. Otherwise, choose the first provided speaker's name in the context\n    The names are case-sensitive and should not be abbreviated or changed.\n    The only names that are accepted are {agentlist}.\n    Respond with ONLY the name of the speaker and DO NOT provide a reason.'

select_speaker_transform_messages class-attribute instance-attribute

select_speaker_transform_messages = None

select_speaker_auto_verbose class-attribute instance-attribute

select_speaker_auto_verbose = False

select_speaker_auto_model_client_cls class-attribute instance-attribute

select_speaker_auto_model_client_cls = None

select_speaker_auto_llm_config class-attribute instance-attribute

select_speaker_auto_llm_config = None

role_for_select_speaker_messages class-attribute instance-attribute

role_for_select_speaker_messages = 'system'

eligibility_policies class-attribute instance-attribute

eligibility_policies = field(default_factory=list)

DEFAULT_INTRO_MSG class-attribute instance-attribute

DEFAULT_INTRO_MSG = 'Hello everyone. We have assembled a great team today to answer questions and solve tasks. In attendance are:'

allowed_speaker_transitions_dict class-attribute instance-attribute

allowed_speaker_transitions_dict = field(init=False)

agent_names property

agent_names

Return the names of the agents in the group chat.

reset

reset()

Reset the group chat.

append

append(message, speaker)

Append a message to the group chat.

agent_by_name

agent_by_name(name, recursive=False, raise_on_name_conflict=False)

Returns the agent with a given name. If recursive is True, it will search in nested teams.

nested_agents

nested_agents()

Returns all agents in the group chat manager.

next_agent

next_agent(agent, agents=None)

Return the next agent in the list.

select_speaker_msg

select_speaker_msg(agents=None)

Return the system message for selecting the next speaker. This is always the first message in the context.

select_speaker_prompt

select_speaker_prompt(agents=None)

Return the floating system prompt selecting the next speaker. This is always the last message in the context. Will return None if the select_speaker_prompt_template is None.

introductions_msg

introductions_msg(agents=None)

Return the system message for selecting the next speaker. This is always the first message in the context.

manual_select_speaker

manual_select_speaker(agents=None)

Manually select the next speaker.

random_select_speaker

random_select_speaker(agents=None)

Randomly select the next speaker.

select_speaker

select_speaker(last_speaker, selector)

Select the next speaker (with requery).

a_select_speaker

a_select_speaker(last_speaker, selector)

Select the next speaker (with requery), asynchronously.

a_auto_select_speaker

a_auto_select_speaker(last_speaker, selector, messages, agents)

(Asynchronous) Selects next speaker for the "auto" speaker selection method. Utilises its own two-agent chat to determine the next speaker and supports requerying.