microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
31.66k stars 4.6k forks source link

[Feature Request]: Add TransformMessages support to GroupChat's nested Select Speaker conversation #2583

Open marklysze opened 5 months ago

marklysze commented 5 months ago

Is your feature request related to a problem? Please describe.

GroupChat uses a nested conversation between two agents. Currently it does not utilise the recent TransformMessages capability nor does it provide users a way to provide their own message transforms to select speaker messages.

The TransformMessages functionality provides the ability to compress messages, truncate/token-limit messages, and add content to existing messages. All of these would increase the robustness of the select speaker process.

cc @WaelKarkoub who I am collaborating with.

Describe the solution you'd like

Implementing default TransformMessages capabilities around text compression and truncation that a user can optionally enable would help users overcome select speaker issues as the total context length increases. Additionally, the option to include the speaker name inside the content of the message would also help link content to agent names during the LLM inference for selecting speakers.

Furthermore, adding the ability for the user to provide their own MessageTransform dictionary to apply would provide flexibility for users to utilise existing transforms or implement their own ones.

For implementation this would involve the addition of attributes and corresponding parameters for GroupChat (as the select speaker functionality is within GroupChat class).

Preliminary, GroupChat parameters being something like:

The defaults will result in no message transformations, matching current functionality.

I'll work on the implementation of this with support from @WaelKarkoub.

Additional context

To provide efficient text compression using LLMs, @WaelKarkoub is looking to add caching to a text compression MessageTransform class. This will be utilised within select speaker.

Related Issues

2499

Nathan-Intergral commented 4 months ago

@marklysze @WaelKarkoub any update on this?

marklysze commented 4 months ago

Hi @Nathan-Intergral, I've been testing out how the transforms work and that led to some in-depth testing on the speaker select that improves the accuracy of responses for non-OpenAI models. That is taking longer than I thought.

I think #2499 would be a good place to continue the conversation around it...

I'm returning to working on it shortly...

Nathan-Intergral commented 4 months ago

@marklysze roger that, thank you for the response!

marklysze commented 4 months ago

I've created #2719, I think this addresses the main foundation for this PR, which is the ability to add TransformMessages to the nested select speaker chat for GroupChat's when the speaker selection method is 'auto'.

The other suggestions in this PR, select_speaker_auto_compression, select_speaker_auto_token_limit, select_speaker_auto_add_name, need further consideration as I'm still investigating which transforms will benefit the select speaker chat the most, particularly for smaller LLMs. The developer can use the TransformMessages capability #2719 covers to do all the transforms they want, so I don't think they need to be addressed immediately.