Made a configurable constant (#1819)

* Made a configurable constant

* Fix typo

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>

---------

Co-authored-by: Joshua Kim <joshkyh@users.noreply.github.com>
This commit is contained in:
Rohit Singh Rathaur
2024-03-10 11:50:47 +05:30
committed by GitHub
parent a5a0540be9
commit b0a8e6e08c

View File

@@ -78,6 +78,11 @@ class GroupChat:
_VALID_SPEAKER_SELECTION_METHODS = ["auto", "manual", "random", "round_robin"]
_VALID_SPEAKER_TRANSITIONS_TYPE = ["allowed", "disallowed", None]
# Define a class attribute for the default introduction message
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: Dict = field(init=False)
def __post_init__(self):
@@ -244,10 +249,11 @@ Then select the next role from {[agent.name for agent in agents]} to play. Only
if agents is None:
agents = self.agents
return f"""Hello everyone. We have assembled a great team today to answer questions and solve tasks. In attendance are:
# Use the class attribute instead of a hardcoded string
intro_msg = self.DEFAULT_INTRO_MSG
participant_roles = self._participant_roles(agents)
{self._participant_roles(agents)}
"""
return f"{intro_msg}\n\n{participant_roles}"
def manual_select_speaker(self, agents: Optional[List[Agent]] = None) -> Union[Agent, None]:
"""Manually select the next speaker."""