diff --git a/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py b/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py index 85750aeb14..6d0059c1aa 100644 --- a/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py +++ b/python/packages/orchestrations/agent_framework_orchestrations/_group_chat.py @@ -147,21 +147,26 @@ def __init__( Example: .. code-block:: python - from agent_framework_orchestrations import GroupChatOrchestrator + from agent_framework import Agent + from agent_framework_orchestrations import GroupChatBuilder, GroupChatState - async def round_robin_selector(state: GroupChatState) -> str: + def round_robin_selector(state: GroupChatState) -> str: # Simple round-robin selection among participants - return state.participants[state.current_round % len(state.participants)] + names = list(state.participants) + return names[state.current_round % len(names)] - orchestrator = GroupChatOrchestrator( - id="group_chat_orchestrator_1", + # GroupChatBuilder creates a GroupChatOrchestrator when given a selection_func. + workflow = GroupChatBuilder( + participants=[ + Agent(client=client, name="researcher"), + Agent(client=client, name="writer"), + ], selection_func=round_robin_selector, - participants=["researcher", "writer"], - name="Coordinator", + orchestrator_name="Coordinator", max_rounds=10, - ) + ).build() """ super().__init__( id, @@ -895,10 +900,10 @@ def with_checkpointing(self, checkpoint_storage: CheckpointStorage) -> GroupChat .. code-block:: python - from agent_framework import MemoryCheckpointStorage + from agent_framework import InMemoryCheckpointStorage from agent_framework_orchestrations import GroupChatBuilder - storage = MemoryCheckpointStorage() + storage = InMemoryCheckpointStorage() workflow = ( GroupChatBuilder( participants=[agent1, agent2],