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

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

Open
marklysze opened this issue May 3, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request group chat group-chat-related issues

Comments

@marklysze
Copy link
Collaborator

marklysze commented May 3, 2024

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:

  • select_speaker_auto_compression - string with option of "" for none, "LLMLingua" to use LLMLingua, "Agent" to use the LLM for the agent (default "")
  • select_speaker_auto_token_limit - bool(defaullt False) will attempt to use max_tokens to limit total context length (needs consideration for non-OpenAI models)
  • select_speaker_auto_add_name - bool (default False) when true will prefix message["content"] with message["name"]
  • select_speaker_auto_message_transforms - dict[MessageTransform] (default None) the set of message transforms to apply, overriding the other options.

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
Copy link
Collaborator

@marklysze @WaelKarkoub any update on this?

@marklysze
Copy link
Collaborator Author

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
Copy link
Collaborator

@marklysze roger that, thank you for the response!

@marklysze
Copy link
Collaborator Author

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.

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

No branches or pull requests

2 participants