Skip to content

server : support content array in OAI chat API #8367

@ggerganov

Description

@ggerganov

According to the OpenAI API, the "content" field of user messages can be both string and array: https://platform.openai.com/docs/api-reference/chat/create

image

So we should support requests such as:

{
  "role": "user",
  "content": [ { "type": "text", "text": "tell me a joke" } ]
}

and

{
  "role": "user",
  "content": [
    { "type": "text", "text": "msg part 0" },
    { "type": "text", "text": "msg part 1" },
    ...
    { "type": "text", "text": "msg part N" }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions