Skip to content

Commit 5b6ae32

Browse files
marklyszesonichi
andauthored
Re-query speaker name when multiple speaker names returned during Group Chat speaker selection (#2304)
* Added requery_on_multiple_speaker_names to GroupChat and updated _finalize_speaker to requery on multiple speaker names (if enabled) * Removed unnecessary comments * Update to current main * Tweak error message. * Comment clarity * Expanded description of Group Chat requery_on_multiple_speaker_names * Reworked to two-way nested chat for speaker selection with default of 2 retries. * Adding validation of new GroupChat attributes * Updates as per @ekzhu's suggestions * Update groupchat - Added select_speaker_auto_multiple_template and select_speaker_auto_none_template - Added max_attempts comment - Re-instated support for role_for_select_speaker_messages - * Update conversable_agent.py Added ability to force override role for a message to support select speaker prompt. * Update test_groupchat.py Updated existing select_speaker test functions as underlying approach has changed, added necessary tests for new functionality. * Removed block for manual selection in select_speaker function. * Catered for no-selection during manual selection mode --------- Co-authored-by: Chi Wang <wang.chi@microsoft.com>
1 parent 5e29ac8 commit 5b6ae32

File tree

3 files changed

+732
-32
lines changed

3 files changed

+732
-32
lines changed

autogen/agentchat/conversable_agent.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,11 @@ def _append_oai_message(self, message: Union[Dict, str], role, conversation_id:
576576

577577
if message.get("role") in ["function", "tool"]:
578578
oai_message["role"] = message.get("role")
579+
elif "override_role" in message:
580+
# If we have a direction to override the role then set the
581+
# role accordingly. Used to customise the role for the
582+
# select speaker prompt.
583+
oai_message["role"] = message.get("override_role")
579584
else:
580585
oai_message["role"] = role
581586

0 commit comments

Comments
 (0)