Skip to content

Commit

Permalink
Made a configurable constant (microsoft#1819)
Browse files Browse the repository at this point in the history
* Made a configurable constant

* Fix typo

Co-authored-by: Joshua Kim <[email protected]>

---------

Co-authored-by: Joshua Kim <[email protected]>
  • Loading branch information
RohitRathore1 and joshkyh authored Mar 10, 2024
1 parent 01cc0ae commit 8aa0fe8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions autogen/agentchat/groupchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ def custom_speaker_selection_func(
_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):
Expand Down Expand Up @@ -244,10 +249,11 @@ def introductions_msg(self, agents: Optional[List[Agent]] = None) -> str:
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."""
Expand Down

0 comments on commit 8aa0fe8

Please sign in to comment.