Skip to content

Content Types

When we chat with an AI, with usually exchange messages (system, user, assistant or tool). A message carries a content, which can be either: - a simple string - one or more chunks

Here are some examples of API responses in both formats:

{
    "role": "user",
    "content": "Hello, you're a useful assistant."
}
{
    "role": "user",
    "content": [
        {"type": "text", "text": "please describe this image"},
        {"image_url": "https://example.com/image.png", "type": "image_url"}
    ]
}

Chunks can be used to send complex data types to Mistral: images, documents, audio... Each role can handle different types of chunks:

Chunk type \ roles User Assistant System Tool
Text
Image URL
Document URL
File
Reference
Thinking
Audio

All roles can handle simple string content.

So, when you create a message, depending on your use case, you have to choose between a content string or an array of chunks.