autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Delivering multiple system messages is not supported by the local model deployed by the fschat-wrapped OpenAI API, which only supports a single system message

Open aizaiyishunjian opened this issue 2 years ago • 4 comments

GroupChatManager requests the 'messages' of the model, passing multiple system messages.

{
    "messages":[
    {"role": "system", "content": "You are in a role play game. The following roles are available:\n User_proxy: \n Agency_Manager: \n   You are the Project Manager. Be concise and avoid pleasantries. Refrain from any conversations that don"t serve the goal of the user, ie.thank you... \n Agency_Researcher: \n ..."}, 
    {"role": "user", "name": "User_proxy", "content": "\n        如何提高公司订单效益\n        "}, 
    {"role": "system", "content": "Read the above conversation. Then select the next role from ['User_proxy', 'Agency_Manager', 'Agency_Researcher', 'Agency_Strategist', 'Agency_Copywriter'] to play. Only return the role."}]
}

However, for encapsulated OpenAI APIs like fschat, the setting of system messages is overridden, hence only one is retained.:

    def set_system_message(self, system_message: str):
        """Set the system message."""
        self.system_message = system_message


        for message in messages:
            msg_role = message["role"]
            if msg_role == "system":
                conv.set_system_message(message["content"])
            elif msg_role == "user":
                conv.append_message(conv.roles[0], message["content"])
            elif msg_role == "assistant":
                conv.append_message(conv.roles[1], message["content"])
            else:
                raise ValueError(f"Unknown role: {msg_role}")

aizaiyishunjian avatar Nov 08 '23 09:11 aizaiyishunjian

It looks to me like these APIs would also have a problem with the "name" attribute that is important for Group Chat scenarios. I'm not sure compatibility will be easy to achieve. @LittleLittleCloud

afourney avatar Nov 08 '23 17:11 afourney

For the multi-system-message issue, you can override the select_speaker() function. The "name" attribute issue mentioned by @afourney needs attention too.

sonichi avatar Nov 12 '23 03:11 sonichi

multiple 'system' messages are also causing a problem with using litellm proxy on claude 3 models. is there a work around for this issue?

venkat-arvo avatar Mar 22 '24 23:03 venkat-arvo

multiple 'system' messages are also causing a problem with using litellm proxy on claude 3 models. is there a work around for this issue?

here is a potential fix, do you want to try to implement it? https://github.com/microsoft/autogen/issues/1861

ekzhu avatar Mar 23 '24 07:03 ekzhu

Increasingly I think we need middleware for messages. The format AutoGen uses should be able to diverge from that used by the LLMs, with messages transformed just prior to making the LLM call.

afourney avatar Mar 28 '24 03:03 afourney

I'm getting the following error using groupchats with Claude-3. I believe it might be related to this issue. Followed the example on the documentation for configuration.

anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.0.name: Extra inputs are not permitted'}}

j-dominguez9 avatar Apr 11 '24 16:04 j-dominguez9

unlikely that this will be implemented for 0.2 and 0.4 arch obviates the need, I think. please reopen if you object

rysweet avatar Oct 12 '24 02:10 rysweet