-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Customisation of speaker select message and prompt in GroupChat #2182
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2182 +/- ##
===========================================
+ Coverage 37.55% 49.58% +12.02%
===========================================
Files 77 77
Lines 7719 7730 +11
Branches 1657 1795 +138
===========================================
+ Hits 2899 3833 +934
+ Misses 4574 3578 -996
- Partials 246 319 +73
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Some test errors in CI, could you check the test. It looks like the whitespaces in the expected string doesn't match the output.
|
I'm not sure why that is failing, it should match, let me try running tests again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the test failures in CI.
We can't run Open AI tests in CI from branches outside of the Microsoft repo. Can you push your code to a new branch in the Microsoft repo, and create a new PR referencing this one? So we can run the OpenAi test |
Thanks, I'm working to do this now. |
I've put the code changes into a branch in this repository (branch: "2182_custom_select_speaker"), and created a new PR, #2233. Let me know if I can close this now. |
Why are these changes needed?
During a Group Chat the Select Speaker Message (first in the context) and Select Speaker Prompt (last in the context) are hardcoded f-strings based on a role-playing prompt. To provide greater flexibility in the final content (for both OpenAI and especially non-OpenAI models), I'm proposing the ability to customise both messages (while including the ability to include the role descriptions and list).
From my testing with open source/weight LLMs I have found that changing these can influence the LLM noticeably.
Changes
I'm proposing the addition of two new Optional[str] (default is None) attributes of the GroupChat class:
custom_select_speaker_msg
custom_select_speaker_prompt
These will be used in the GroupChat
select_speaker_msg
andselect_speaker_prompt
functions, which will return the current prompt if the respective attributes are None.custom_select_speaker_msg
can include{roles}
in its string, which will be replaced withself._participant_roles(agents)
, and it can include{agentlist}
which will be replaced with{[agent.name for agent in agents]}
.custom_select_speaker_prompt
can include{agentlist}
which will be replaced with{[agent.name for agent in agents]}
.This enables you to replicate the insertion of role descriptions and role lists as per the current prompts.
I have not added a documentation example but will do if we are pushing forward with this change.
Related issue number
This is related to my Draft PR #1746.
Checks