autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Use structured outputs for speaker selection in `SelectorGroupChat`

Open Ethan0456 opened this issue 10 months ago • 2 comments

Why are these changes needed?

To improve the reliability of speaker selection in SelectorGroupChat by using structured outputs.

Related issue number

Closes #5970

Checks

Ethan0456 avatar Mar 19 '25 17:03 Ethan0456

Hi @ekzhu,

I’m encountering the following mypy error:

src/autogen_agentchat/teams/_group_chat/_selector_group_chat.py:183: error: Second
argument of Enum() must be string, tuple, list or dict literal for mypy to determine Enum members [misc]

This error occurs on the line:

AgentName = Enum("AgentName", agent_name_map)

Since we need to dynamically create the Enum, I’m using # type: ignore to bypass the error.

References:

Ethan0456 avatar Mar 19 '25 17:03 Ethan0456

Thanks for the change. We will run some benchmarks on our side and see.

cc @afourney

ekzhu avatar Mar 21 '25 01:03 ekzhu