Skip to content

Support for multi content chat message #6

Description

@Neofox

Hello, I noticed while trying to use the library that ChatMessage only support content as a string.

example:

chat_response = client.chat.complete(
    model = model,
    messages = [
        {
            "role": "user",
            "content": "What is the best French cheese?",
        },
    ]
)

but the actual mistral API like most other LLM support multi content messages, which is extremely useful when trying to send an image as part of a message.
Link to the official documentation: https://docs.mistral.ai/capabilities/vision/

as you can see, a common use case would be to send a message with multipart content.
example:

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": "What's in this image?"
            },
            {
                "type": "image_url",
                "image_url": "https://tripfixers.com/wp-content/uploads/2019/11/eiffel-tower-with-snow.jpeg"
            }
        ]
    }
]

So if we could add the support to this feature it would be pretty nice.
I will start working on the PR, as I don't think it will be complicated to add as a feature.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions