Skip to content

Commit

Permalink
fix & doc: update selector prompt documentation and remove validation…
Browse files Browse the repository at this point in the history
… checks
  • Loading branch information
ekzhu committed Feb 9, 2025
1 parent 15891e8 commit 85fd3c5
Show file tree
Hide file tree
Showing 2 changed files with 693 additions and 523 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ class SelectorGroupChat(BaseGroupChat, Component[SelectorGroupChatConfig]):
Without a termination condition, the group chat will run indefinitely.
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.
Must contain '{roles}', '{participants}', and '{history}' to be filled in.
Available fields: '{roles}', '{participants}', and '{history}'.
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.
Expand Down Expand Up @@ -418,13 +418,6 @@ def __init__(
# Validate the participants.
if len(participants) < 2:
raise ValueError("At least two participants are required for SelectorGroupChat.")
# Validate the selector prompt.
if "{roles}" not in selector_prompt:
raise ValueError("The selector prompt must contain '{roles}'")
if "{participants}" not in selector_prompt:
raise ValueError("The selector prompt must contain '{participants}'")
if "{history}" not in selector_prompt:
raise ValueError("The selector prompt must contain '{history}'")
self._selector_prompt = selector_prompt
self._model_client = model_client
self._allow_repeated_speaker = allow_repeated_speaker
Expand Down
Loading

0 comments on commit 85fd3c5

Please sign in to comment.