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

Ability to add MessageTransforms to the GroupChat's Select Speaker nested chat (speaker_selection_method='auto') #2719

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

marklysze
Copy link
Collaborator

@marklysze marklysze commented May 19, 2024

This provides the ability to add MessageTransforms to the nested select speaker chat that occurs in a GroupChat when the speaker selection method is 'auto'. The MessageTransforms apply only to the messages within that nested select speaker chat (and not to the broader GroupChat chat).

The GroupChat constructor has a new, optional, parameter called select_speaker_auto_message_transforms that takes in a MessageTransforms object, or None.

Within GroupChat, the provided MessageTransforms object will be assigned to self._auto_message_transforms and used within _auto_select_speaker and a_auto_select_speaker.

The nested select speaker chat has two agents, checking_agent and speaker_selection_agent and the MessageTransforms are added to the speaker_selection_agent as that is the agent that utilises the LLM.

I have not added documentation, yet, as I wanted to have it reviewed first.

cc @Nathan-Intergral, @WebsheetPlugin

Why are these changes needed?

These changes enable greater control and flexibility of messages for speaker selection. Particularly useful for non-OpenAI models with limited context / reasoning ability.

Related issue number

Addresses #2499.

Addresses part of #2583.

I will carry forward other suggested changes in #2583 - select_speaker_auto_compression, select_speaker_auto_token_limit, select_speaker_auto_token_limit - it is useful to have these simple methods to enable message transforms without the developer having to create them, however as I test the effectiveness of the select speaker method I need more time to think through what would be most beneficial.

Checks

@marklysze marklysze added the group chat group-chat-related issues label May 19, 2024
@marklysze marklysze self-assigned this May 19, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 16.90%. Comparing base (19de99e) to head (678f9c0).

Files Patch % Lines
autogen/agentchat/groupchat.py 18.18% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2719       +/-   ##
===========================================
- Coverage   34.36%   16.90%   -17.46%     
===========================================
  Files          87       87               
  Lines        9336     9347       +11     
  Branches     1987     2143      +156     
===========================================
- Hits         3208     1580     -1628     
- Misses       5862     7705     +1843     
+ Partials      266       62      -204     
Flag Coverage Δ
unittests 16.86% <25.00%> (-17.51%) ⬇️

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.

autogen/agentchat/groupchat.py Outdated Show resolved Hide resolved
autogen/agentchat/groupchat.py Outdated Show resolved Hide resolved
autogen/agentchat/groupchat.py Outdated Show resolved Hide resolved
test/agentchat/test_groupchat.py Show resolved Hide resolved
Copy link
Collaborator

@ekzhu ekzhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me

@marklysze
Copy link
Collaborator Author

I'll add a topic under Group Chat in the documentation on using transform messages for the select speaker nested chat.

@marklysze
Copy link
Collaborator Author

Okay, I've added a topic to the conversation to show how to apply Transform Messages to the speaker selection nested-chat. Let me know if there's anything else to do/change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group chat group-chat-related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants