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]: Allowing user to specify the "role" field for select speaker messages #1861

Closed
ekzhu opened this issue Mar 5, 2024 · 8 comments
Assignees
Labels
group chat/teams group-chat-related issues models Pertains to using alternate, non-GPT, models (e.g., local models, llama, etc.)

Comments

@ekzhu
Copy link
Collaborator

ekzhu commented Mar 5, 2024

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

Based on discussion in this thread: #991. Mistral (and maybe other open source LLMs) requires the system messages to be before messages with user and assistant roles. So GroupChat select speaker "auto" mode can fail when the messages' roles are not in expected order.

I know #1791 is adding a more general way to address this, but a simpler approach should help to fix this without asking user to write custom function.

Describe the solution you'd like

In GroupChat's constructor, add a field role_for_select_speaker_messages with default set to system. use this field in select speaker function in "auto" mode.

Additional context

The expected values for role_for_select_speaker_messages would be system and user.

The role in current line:

{"role": "system", "content": self.select_speaker_prompt(graph_eligible_agents)}

can be customized based on the field role_for_select_speaker_messages.

No response

@ekzhu ekzhu added enhancement group chat/teams group-chat-related issues models Pertains to using alternate, non-GPT, models (e.g., local models, llama, etc.) labels Mar 5, 2024
@ekzhu
Copy link
Collaborator Author

ekzhu commented Mar 5, 2024

@joshkyh
Copy link
Collaborator

joshkyh commented Mar 5, 2024

Hey @ekzhu, can you give us some examples under Additional Context of this ticket on what are the expected values for role_for_select_speaker_messages and how each value would affect the GroupChat instance behaviour?

@ekzhu
Copy link
Collaborator Author

ekzhu commented Mar 5, 2024

Hey @ekzhu, can you give us some examples under Additional Context of this ticket on what are the expected values for role_for_select_speaker_messages and how each value would affect the GroupChat instance behaviour?

Updated the description.

@ekzhu
Copy link
Collaborator Author

ekzhu commented Mar 5, 2024

@YangQiuEric @Liques @richdrummer33 @akashAD98 @spincrisis @dsalas-crogl have all reported this issue.

@marklysze
Copy link
Collaborator

I've also recently had an issue with the role:system problem. I believe it was when I tried to use Huggingface's API, only user and assistant were valid roles. Being able to replace system with user would help.

@marklysze marklysze self-assigned this Mar 24, 2024
@marklysze
Copy link
Collaborator

I'll look into this and try and get it sorted out :)

@marklysze
Copy link
Collaborator

I've submitted a PR, #2167, to address the change to GroupChat to enable the setting of the role name for select speaker messages.

New constructor parameter as per @ekzhu's suggestion above - role_for_select_speaker_messages on the GroupChat's constructor, which is an optional string attribute that defaults to system.

Also includes:

  • Added a Tips for Non-OpenAI models page to documentation (should be a basis for future tips)
  • Added a sub-section on the Conversation Patterns tutorial explaining the new attribute and provided an example

github-merge-queue bot pushed a commit that referenced this issue Mar 31, 2024
… Group Chats (Replaces PR #2167) (#2199)

* Re-commit of code from PR (#2167) addressing #1861, due to wrong basing

* Update website/docs/topics/non-openai-models/best-tips-for-nonopenai-models.md

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* Removed unnecessary notebook images

* Update conversation-patterns.ipynb

Updated to include note about being applicable when auto.

* Updated to include checks that the role is not blank/None. Added tests.

* Changed try-except to use pytest

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
@ekzhu
Copy link
Collaborator Author

ekzhu commented Apr 4, 2024

This is done by #2199

@ekzhu ekzhu closed this as completed Apr 4, 2024
whiskyboy pushed a commit to whiskyboy/autogen that referenced this issue Apr 17, 2024
… Group Chats (Replaces PR microsoft#2167) (microsoft#2199)

* Re-commit of code from PR (microsoft#2167) addressing microsoft#1861, due to wrong basing

* Update website/docs/topics/non-openai-models/best-tips-for-nonopenai-models.md

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>

* Removed unnecessary notebook images

* Update conversation-patterns.ipynb

Updated to include note about being applicable when auto.

* Updated to include checks that the role is not blank/None. Added tests.

* Changed try-except to use pytest

---------

Co-authored-by: Eric Zhu <ekzhu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group chat/teams group-chat-related issues models Pertains to using alternate, non-GPT, models (e.g., local models, llama, etc.)
Projects
None yet
Development

No branches or pull requests

3 participants