@@ -609,7 +609,6 @@ def _auto_select_speaker(
609
609
610
610
# Registered reply function for checking_agent, checks the result of the response for agent names
611
611
def validate_speaker_name (recipient , messages , sender , config ) -> Tuple [bool , Union [str , Dict , None ]]:
612
-
613
612
# The number of retries left, starting at max_retries_for_selecting_speaker
614
613
nonlocal attempts_left
615
614
nonlocal attempt
@@ -708,7 +707,6 @@ async def a_auto_select_speaker(
708
707
709
708
# Registered reply function for checking_agent, checks the result of the response for agent names
710
709
def validate_speaker_name (recipient , messages , sender , config ) -> Tuple [bool , Union [str , Dict , None ]]:
711
-
712
710
# The number of retries left, starting at max_retries_for_selecting_speaker
713
711
nonlocal attempts_left
714
712
nonlocal attempt
@@ -782,7 +780,6 @@ def _validate_speaker_name(
782
780
mentions = self ._mentioned_agents (select_name , agents )
783
781
784
782
if len (mentions ) == 1 :
785
-
786
783
# Success on retry, we have just one name mentioned
787
784
selected_agent_name = next (iter (mentions ))
788
785
@@ -864,17 +861,14 @@ def _process_speaker_selection_result(self, result, last_speaker: ConversableAge
864
861
865
862
Used by auto_select_speaker and a_auto_select_speaker."""
866
863
if len (result .chat_history ) > 0 :
867
-
868
864
# Use the final message, which will have the selected agent or reason for failure
869
865
final_message = result .chat_history [- 1 ]["content" ]
870
866
871
867
if "[AGENT SELECTED]" in final_message :
872
-
873
868
# Have successfully selected an agent, return it
874
869
return self .agent_by_name (final_message .replace ("[AGENT SELECTED]" , "" ))
875
870
876
871
else : # "[AGENT SELECTION FAILED]"
877
-
878
872
# Failed to select an agent, so we'll select the next agent in the list
879
873
next_agent = self .next_agent (last_speaker , agents )
880
874
@@ -945,7 +939,7 @@ def __init__(
945
939
name : Optional [str ] = "chat_manager" ,
946
940
# unlimited consecutive auto reply by default
947
941
max_consecutive_auto_reply : Optional [int ] = sys .maxsize ,
948
- human_input_mode : Optional [ str ] = "NEVER" ,
942
+ human_input_mode : Literal [ "ALWAYS" , "NEVER" , "TERMINATE" ] = "NEVER" ,
949
943
system_message : Optional [Union [str , List ]] = "Group chat manager." ,
950
944
silent : bool = False ,
951
945
** kwargs ,
@@ -1207,7 +1201,6 @@ def resume(
1207
1201
1208
1202
# Load the messages into the group chat
1209
1203
for i , message in enumerate (messages ):
1210
-
1211
1204
if "name" in message :
1212
1205
message_speaker_agent = self ._groupchat .agent_by_name (message ["name" ])
1213
1206
else :
@@ -1312,7 +1305,6 @@ async def a_resume(
1312
1305
1313
1306
# Load the messages into the group chat
1314
1307
for i , message in enumerate (messages ):
1315
-
1316
1308
if "name" in message :
1317
1309
message_speaker_agent = self ._groupchat .agent_by_name (message ["name" ])
1318
1310
else :
0 commit comments