You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the code in GroupChatManager.run_chat when GroupChat.select_speaker raise NoEligibleSpeaker , the groupchat will be terminated. This feature enables coders to define termination conditions in customized speaker_selection_method.
defrun_chat(
self,
messages: Optional[list[dict]] =None,
sender: Optional[Agent] =None,
config: Optional[GroupChat] =None,
) ->tuple[bool, Optional[str]]:
"""Run a group chat."""# other codes before ...foriinrange(groupchat.max_round):
self._last_speaker=speakergroupchat.append(message, speaker)
# broadcast the message to all agents except the speakerforagentingroupchat.agents:
ifagent!=speaker:
self.send(message, agent, request_reply=False, silent=True)
ifself._is_termination_msg(message) ori==groupchat.max_round-1:
# The conversation is over or it's the last roundbreaktry:
# select the next speakerspeaker=groupchat.select_speaker(speaker, self)
ifnotsilent:
iostream=IOStream.get_default()
iostream.print(colored(f"\nNext speaker: {speaker.name}\n", "green"), flush=True)
# let the speaker speakreply=speaker.generate_reply(sender=self)
exceptKeyboardInterrupt:
# let the admin agent speak if interruptedifgroupchat.admin_nameingroupchat.agent_names:
# admin agent is one of the participantsspeaker=groupchat.agent_by_name(groupchat.admin_name)
reply=speaker.generate_reply(sender=self)
else:
# admin agent is not found in the participantsraiseexceptNoEligibleSpeaker:
# No eligible speaker, terminate the conversationbreak# other codes after ...returnTrue, None
However, it seems that GroupChatManager.a_run_chat do not have this feature.
I am not sure whether it is a feature or bug.
asyncdefa_run_chat(
self,
messages: Optional[list[dict]] =None,
sender: Optional[Agent] =None,
config: Optional[GroupChat] =None,
):
# other codes before ...foriinrange(groupchat.max_round):
groupchat.append(message, speaker)
ifself._is_termination_msg(message):
# The conversation is overbreak# broadcast the message to all agents except the speakerforagentingroupchat.agents:
ifagent!=speaker:
awaitself.a_send(message, agent, request_reply=False, silent=True)
ifi==groupchat.max_round-1:
# the last roundbreaktry:
# select the next speakerspeaker=awaitgroupchat.a_select_speaker(speaker, self)
# let the speaker speakreply=awaitspeaker.a_generate_reply(sender=self)
exceptKeyboardInterrupt:
# let the admin agent speak if interruptedifgroupchat.admin_nameingroupchat.agent_names:
# admin agent is one of the participantsspeaker=groupchat.agent_by_name(groupchat.admin_name)
reply=awaitspeaker.a_generate_reply(sender=self)
else:
# admin agent is not found in the participantsraise# It does not have the following exception handler# except NoEligibleSpeaker: # breakifreplyisNone:
break# other codes after ...
Steps to reproduce
Define a speaker_selection_method returning None under some conditions. ( That should be a proper case when we try to define the termination condition
Model Used
No response
Expected Behavior
No response
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the code in GroupChatManager.run_chat when GroupChat.select_speaker raise NoEligibleSpeaker , the groupchat will be terminated. This feature enables coders to define termination conditions in customized speaker_selection_method.
However, it seems that GroupChatManager.a_run_chat do not have this feature.
I am not sure whether it is a feature or bug.
Steps to reproduce
Define a speaker_selection_method returning None under some conditions. ( That should be a proper case when we try to define the termination condition
Model Used
No response
Expected Behavior
No response
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: