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

Custom Model Client class support for 'auto' speaker selection in Group Chat #65

Merged
merged 3 commits into from
Oct 20, 2024

Conversation

marklysze
Copy link
Collaborator

@marklysze marklysze commented Oct 16, 2024

Why are these changes needed?

If you are you using a custom model client class and want to use it for the the inner speaker selection chat when using auto speaker selection, it isn't possible at the moment as it uses the GroupChatManager's config by default.

This addresses this bug by registering the custom model client class during the creation of the inner speaker_selection_agent.

To assign a custom model client class and config to the inner auto speaker selection agent you need to register the config and client class with the GroupChat object, see example below.

# Import your custom model client class
from mycustommodelclient import MyCustomModelClient

# Example llm_config
custom_llm_config = {
    "config_list":
    [
        {
            "model_client_cls": "MyCustomModelClient",
        }
    ]
}

# Updated GroupChat creation with config and client classes registered
gc = GroupChat(
    agents=[mark, alexandra, elizabeth],
    speaker_selection_method="auto",
    allow_repeat_speaker=False,
    select_speaker_auto_verbose=True,
    select_speaker_auto_llm_config=custom_llm_config,
    select_speaker_auto_model_client_cls=MyCustomModelClient,
    max_round=5,
    messages=[]
)

Two new properties exist:

  • select_speaker_auto_llm_config: Set this to your llm_config
  • select_speaker_auto_model_client_cls: Set this to the class of your custom model client

Documentation update to come.

Related issue number

Raised by Jason_DataScience on Discord.

Checks

@Hk669
Copy link
Collaborator

Hk669 commented Oct 16, 2024

@marklysze have you tested this PR.

@marklysze
Copy link
Collaborator Author

marklysze commented Oct 16, 2024

Hey @Hk669, yes, I've tested it and also passes pytest :)

I'm in the process of adding some documentation before final review.

@marklysze
Copy link
Collaborator Author

Okay, @Hk669, I've added a documentation page as well, so good for review.

@marklysze marklysze self-assigned this Oct 18, 2024
@Hk669
Copy link
Collaborator

Hk669 commented Oct 18, 2024

Thanks @marklysze , let me go through the docs and test it locally.

Copy link

@qingyun-wu qingyun-wu left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks Mark!

@qingyun-wu
Copy link

@Hk669 Have you finished testing? Thank you!

@qingyun-wu qingyun-wu enabled auto-merge October 20, 2024 18:44
@qingyun-wu qingyun-wu added this pull request to the merge queue Oct 20, 2024
Merged via the queue into main with commit 1111adc Oct 20, 2024
157 of 164 checks passed
@qingyun-wu qingyun-wu deleted the groupchatcustomclient branch October 20, 2024 19:17
odoochain pushed a commit to odoochain/autogen that referenced this pull request Nov 10, 2024
…hub#65)

* initial pipeline

* setting branches

* renaming workflow to workflows

* no needed permissions for building

* testing pipeline

* testing pipeline

* testing pipeline

* tweak marketing workflow

* tweak paths

* change to pwsh

* updating run-names

* trying if I can pass --no-state as a param

* setting --no-state second try

* renaming

* powershell

* add PR number to the run-name

* run-name

* run name test # 2000

* Confident that this will be the last try

---------

Co-authored-by: Kosta Petan <[email protected]>
odoochain pushed a commit to odoochain/autogen that referenced this pull request Nov 10, 2024
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.

3 participants