Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve speaker selection in SelectorGroupChat for weaker models #5454

Merged
merged 6 commits into from
Feb 8, 2025

Conversation

ekzhu
Copy link
Collaborator

@ekzhu ekzhu commented Feb 8, 2025

Don't throw an exception when model makes a mistake. Use retries, and if not succeeding after a fixed attempts, fall back to the previous sepaker if available, or the first participant.

Resolves #5453

@ekzhu ekzhu changed the title fix: improve logging for repeated speaker selection in group chat fix: improve speaker selection in SelectorGroupChat for weaker models Feb 8, 2025
@ekzhu ekzhu requested a review from afourney February 8, 2025 23:03
@afourney
Copy link
Member

afourney commented Feb 8, 2025

Looks good. This is a pretty general pattern. We need it in many places like web surfer, orchestrator, file surfer, etc. Really, anywhere where structured or verifiable output is needed. I wonder if there's a more general component or strategy we could provide?

Copy link

codecov bot commented Feb 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.20%. Comparing base (0b659de) to head (973cf48).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5454      +/-   ##
==========================================
+ Coverage   78.11%   78.20%   +0.08%     
==========================================
  Files         158      158              
  Lines        9602     9626      +24     
==========================================
+ Hits         7501     7528      +27     
+ Misses       2101     2098       -3     
Flag Coverage Δ
unittests 78.20% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ekzhu
Copy link
Collaborator Author

ekzhu commented Feb 8, 2025

Looks good. This is a pretty general pattern. We need it in many places like web surfer, orchestrator, file surfer, etc. Really, anywhere where structured or verifiable output is needed. I wonder if there's a more general component or strategy we could provide?

Yeah, it seems to be a general strategy when it comes to generation-verification. We can consider making this more general, e.g.,

async def RetryOnVerification(model_client, initial_prompt, verification_func, default_output):
    ...

@ekzhu ekzhu enabled auto-merge (squash) February 8, 2025 23:13
@ekzhu ekzhu merged commit 426b898 into main Feb 8, 2025
63 checks passed
@ekzhu ekzhu deleted the ekzhu-selector-flexibility branch February 8, 2025 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid throwing error on model mistakes in SelectorGroupChat builtin selector
2 participants