Skip to content

Add support for message content as an array in OpenAIMockResponsePlugin #1174

Closed
@garrytrinder

Description

@garrytrinder

The following payload is a valid request that can be sent to Azure Open AI chat completions endpoints. The OpenAIMockResponsePlugin skips this request as it expects content to be a string, we should add support for requests that use an array as well as a string.

{
    "messages": [
        {
            "role": "developer",
            "content": [
                {
                    "type": "text",
                    "text": "You are an AI assistant that helps people find information."
                }
            ]
        },
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Hey 👋"
                }
            ]
        },
        {
            "role": "assistant",
            "content": [
                {
                    "type": "text",
                    "text": "Hello there! 👋 How can I help you today?"
                }
            ]
        }
    ],
    "max_completion_tokens": 100000
}

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions