NoEligibleSpeaker: Custom speaker selection function returned None. Terminating conversation. #5588
Replies: 5 comments 4 replies
|
I'm using V0.2 btw |
|
I'm facing similar problems |
|
Eric Zhu (@ekzhu), any idea on why this could be happening? I'm using a similar method for state transition in another project, this error doesn't occur there at all. |
|
That message means the speaker-selection function returned something AutoGen could not use as the next speaker. In your code there are two common ways that can happen. First, the final branch returns elif last_speaker is terminator:
return NoneIf you want the conversation to end, it is better to end through a normal termination condition/message instead of relying on the custom speaker selector returning Second, all your checks use identity comparisons: if last_speaker is user_proxy:
elif last_speaker is planner:That only works if the objects in the I would make the function fail loudly while debugging: def state_transition(last_speaker, groupchat):
print('last speaker:', last_speaker.name)
if last_speaker.name == user_proxy.name:
return planner if len(groupchat.messages) == 1 else retrieval
if last_speaker.name == planner.name:
content = groupchat.messages[-1].get('content', '').lower()
return terminator if 'terminate-flow' in content else retrieval
if last_speaker.name == retrieval.name:
content = groupchat.messages[-1].get('content', '').lower()
if 'terminate-flow' in content:
return terminator
if 'terminate-agent' in content:
return answer_generator
return retrieval
if last_speaker.name == answer_generator.name:
content = groupchat.messages[-1].get('content', '').lower()
if 'terminate-flow' in content:
return terminator
if 'terminate-agent' in content:
return critic
return answer_generator
if last_speaker.name == critic.name:
content = groupchat.messages[-1].get('content', '').lower()
return terminator if 'all-good' in content else retrieval
if last_speaker.name == terminator.name:
# Let your termination condition end the chat after this message.
return user_proxy
raise ValueError(f'Unhandled speaker: {last_speaker.name}')The important part is the final |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is the code that I'm using, and it gives me a error which says : "NoEligibleSpeaker: Custom speaker selection function returned None. Terminating conversation.". Please help.
def state_transition(last_speaker, groupchat):
messages = groupchat.messages
last_message = messages[-1] if messages else {}
All reactions