[Feature Request]: Allow all system role message to be placed at the beginning of messages
Is your feature request related to a problem? Please describe.
Some LLM models (such as the Qwen series models) only allow all system messages to be placed at the beginning of the messages, and cannot end with a system message.
For example, the group chat demo (https://microsoft.github.io/autogen/docs/tutorial/conversation-patterns#group-chat), will generate the bellow messages:
messages=[
{
"content": "You are in a role play game. The following roles are available:\n Adder_Agent: Add 1 to each input number.\nMultiplier_Agent: Multiply each input number by 2.\nSubtracter_Agent: Subtract 1 from each input number.\nDivider_Agent: Divide each input number by 2.\nNumber_Agent: Return the numbers given..\n Read the following conversation.\n Then select the next role from ['Adder_Agent', 'Multiplier_Agent', 'Subtracter_Agent', 'Divider_Agent', 'Number_Agent'] to play. Only return the role.",
"role": "system",
},
{
"content": "My number is 3, I want to turn it into 13.",
"role": "user",
},
{
"content": "Read the above conversation. Then select the next role from ['Adder_Agent', 'Multiplier_Agent', 'Subtracter_Agent', 'Divider_Agent', 'Number_Agent'] to play. Only return the role.",
"role": "system",
},
]
I found that the Qwen model dose not support ends with "system" role message in chat messages. Is there any way to change the above auto generate message to the like following messages?Move all "system" role message to the begin of messages.
messages=[
{
"content": "You are in a role play game. The following roles are available:\n Adder_Agent: Add 1 to each input number.\nMultiplier_Agent: Multiply each input number by 2.\nSubtracter_Agent: Subtract 1 from each input number.\nDivider_Agent: Divide each input number by 2.\nNumber_Agent: Return the numbers given..\n Read the following conversation.\n Then select the next role from ['Adder_Agent', 'Multiplier_Agent', 'Subtracter_Agent', 'Divider_Agent', 'Number_Agent'] to play. Only return the role.",
"role": "system",
},
{
"content": "Read the below conversation. Then select the next role from ['Adder_Agent', 'Multiplier_Agent', 'Subtracter_Agent', 'Divider_Agent', 'Number_Agent'] to play. Only return the role.",
"role": "system",
},
{
"content": "My number is 3, I want to turn it into 13.",
"role": "user",
},
]
This is work fine with the Qwen model. So can I customize the message template to generate the above message format?Or any other suggestion?
I notice that can custom select_speaker_message_template and select_speaker_prompt_template of GroupChat template, but can't change their positions.
Thanks for your good job.
Describe the solution you'd like
No response
Additional context
No response
I find the answer on the document:
Autogen provides a way to set the value of the select speaker message's role to any string value by setting the
role_for_select_speaker_messagesparameter in the GroupChat's constructor. The default value issystemand by setting it touseryou can accommodate the last message role requirement of Mistral.AI's API.
Keep calling from Google accounts these people have stolen money's from me and are acting as me these are hackers hacking me please contact fbi
On Tue, Jun 11, 2024, 11:34 AM linuxsong @.***> wrote:
Closed #2914 https://github.com/microsoft/autogen/issues/2914 as completed.
— Reply to this email directly, view it on GitHub https://github.com/microsoft/autogen/issues/2914#event-13119969560, or unsubscribe https://github.com/notifications/unsubscribe-auth/BI3MSTBD6YNZT3XS5S2E3U3ZG4RLBAVCNFSM6AAAAABJEJOCA6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGEYTSOJWHE2TMMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>