Skip to content

Commit 653bcc5

Browse files
authored
Document custom message types in teams API docs (#6400)
Addresses: #6365
1 parent 7811b1c commit 653bcc5

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_group_chat.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ class MagenticOneGroupChat(BaseGroupChat, Component[MagenticOneGroupChatConfig])
4747
max_turns (int, optional): The maximum number of turns in the group chat before stopping. Defaults to 20.
4848
max_stalls (int, optional): The maximum number of stalls allowed before re-planning. Defaults to 3.
4949
final_answer_prompt (str, optional): The LLM prompt used to generate the final answer or response from the team's transcript. A default (sensible for GPT-4o class models) is provided.
50+
custom_message_types (List[type[BaseAgentEvent | BaseChatMessage]], optional): A list of custom message types that will be used in the group chat.
51+
If you are using custom message types or your agents produces custom message types, you need to specify them here.
52+
Make sure your custom message types are subclasses of :class:`~autogen_agentchat.messages.BaseAgentEvent` or :class:`~autogen_agentchat.messages.BaseChatMessage`.
5053
emit_team_events (bool, optional): Whether to emit team events through :meth:`BaseGroupChat.run_stream`. Defaults to False.
5154
5255
Raises:
@@ -105,6 +108,7 @@ def __init__(
105108
runtime: AgentRuntime | None = None,
106109
max_stalls: int = 3,
107110
final_answer_prompt: str = ORCHESTRATOR_FINAL_ANSWER_PROMPT,
111+
custom_message_types: List[type[BaseAgentEvent | BaseChatMessage]] | None = None,
108112
emit_team_events: bool = False,
109113
):
110114
super().__init__(
@@ -114,6 +118,7 @@ def __init__(
114118
termination_condition=termination_condition,
115119
max_turns=max_turns,
116120
runtime=runtime,
121+
custom_message_types=custom_message_types,
117122
emit_team_events=emit_team_events,
118123
)
119124

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_round_robin_group_chat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ class RoundRobinGroupChat(BaseGroupChat, Component[RoundRobinGroupChatConfig]):
9797
termination_condition (TerminationCondition, optional): The termination condition for the group chat. Defaults to None.
9898
Without a termination condition, the group chat will run indefinitely.
9999
max_turns (int, optional): The maximum number of turns in the group chat before stopping. Defaults to None, meaning no limit.
100+
custom_message_types (List[type[BaseAgentEvent | BaseChatMessage]], optional): A list of custom message types that will be used in the group chat.
101+
If you are using custom message types or your agents produces custom message types, you need to specify them here.
102+
Make sure your custom message types are subclasses of :class:`~autogen_agentchat.messages.BaseAgentEvent` or :class:`~autogen_agentchat.messages.BaseChatMessage`.
100103
emit_team_events (bool, optional): Whether to emit team events through :meth:`BaseGroupChat.run_stream`. Defaults to False.
101104
102105
Raises:

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@ class SelectorGroupChat(BaseGroupChat, Component[SelectorGroupChatConfig]):
344344
A custom function that takes the conversation history and returns a filtered list of candidates for the next speaker
345345
selection using model. If the function returns an empty list or `None`, `SelectorGroupChat` will raise a `ValueError`.
346346
This function is only used if `selector_func` is not set. The `allow_repeated_speaker` will be ignored if set.
347+
custom_message_types (List[type[BaseAgentEvent | BaseChatMessage]], optional): A list of custom message types that will be used in the group chat.
348+
If you are using custom message types or your agents produces custom message types, you need to specify them here.
349+
Make sure your custom message types are subclasses of :class:`~autogen_agentchat.messages.BaseAgentEvent` or :class:`~autogen_agentchat.messages.BaseChatMessage`.
347350
emit_team_events (bool, optional): Whether to emit team events through :meth:`BaseGroupChat.run_stream`. Defaults to False.
348351
model_client_streaming (bool, optional): Whether to use streaming for the model client. (This is useful for reasoning models like QwQ). Defaults to False.
349352

python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_swarm_group_chat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ class Swarm(BaseGroupChat, Component[SwarmConfig]):
129129
termination_condition (TerminationCondition, optional): The termination condition for the group chat. Defaults to None.
130130
Without a termination condition, the group chat will run indefinitely.
131131
max_turns (int, optional): The maximum number of turns in the group chat before stopping. Defaults to None, meaning no limit.
132+
custom_message_types (List[type[BaseAgentEvent | BaseChatMessage]], optional): A list of custom message types that will be used in the group chat.
133+
If you are using custom message types or your agents produces custom message types, you need to specify them here.
134+
Make sure your custom message types are subclasses of :class:`~autogen_agentchat.messages.BaseAgentEvent` or :class:`~autogen_agentchat.messages.BaseChatMessage`.
132135
emit_team_events (bool, optional): Whether to emit team events through :meth:`BaseGroupChat.run_stream`. Defaults to False.
133136
134137
Basic example:

0 commit comments

Comments
 (0)