From 63b108598b125fb670c29d117ebb0cf619e0d1e2 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Fri, 25 Apr 2025 16:08:50 -0700 Subject: [PATCH 1/2] Clarify selector prompt --- .../agentchat-user-guide/selector-group-chat.ipynb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/selector-group-chat.ipynb b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/selector-group-chat.ipynb index f00ce7e36942..ca7e15895b51 100644 --- a/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/selector-group-chat.ipynb +++ b/python/packages/autogen-core/docs/src/user-guide/agentchat-user-guide/selector-group-chat.ipynb @@ -272,6 +272,11 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "The string variables available in the selector prompt are:\n", + "- `{participants}`: The names of candidates for selection. The format is `[\"\", \"\", ...]`.\n", + "- `{roles}`: A newline-separated list of names and descriptions of the candidate agents. The format for each line is: `\" : \"`.\n", + "- `{history}`: The conversation history formatted as a double newline separated of names and message content. The format for each message is: `\" : \"`.\n", + "\n", "```{tip}\n", "Try not to overload the model with too much instruction in the selector prompt.\n", "\n", @@ -1018,7 +1023,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.9" + "version": "3.12.3" } }, "nbformat": 4, From c1eca1392e1f565da194db37b735ec8afb2a0776 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Fri, 25 Apr 2025 16:11:15 -0700 Subject: [PATCH 2/2] Update api doc --- .../teams/_group_chat/_selector_group_chat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py b/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py index 2af568ac4981..b55d4c4fe919 100644 --- a/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py +++ b/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py @@ -328,6 +328,9 @@ class SelectorGroupChat(BaseGroupChat, Component[SelectorGroupChatConfig]): max_turns (int, optional): The maximum number of turns in the group chat before stopping. Defaults to None, meaning no limit. selector_prompt (str, optional): The prompt template to use for selecting the next speaker. Available fields: '{roles}', '{participants}', and '{history}'. + `{participants}` is the names of candidates for selection. The format is `["", "", ...]`. + `{roles}` is a newline-separated list of names and descriptions of the candidate agents. The format for each line is: `" : "`. + `{history}` is the conversation history formatted as a double newline separated of names and message content. The format for each message is: `" : "`. allow_repeated_speaker (bool, optional): Whether to include the previous speaker in the list of candidates to be selected for the next turn. Defaults to False. The model may still select the previous speaker -- a warning will be logged if this happens. max_selector_attempts (int, optional): The maximum number of attempts to select a speaker using the model. Defaults to 3.