mistral_common.protocol.instruct.messages
AssistantMessage(**data)
Bases: BaseMessage
Assistant message.
Attributes:
Name | Type | Description |
---|---|---|
role |
Literal[assistant]
|
The role of the message. |
content |
Optional[str]
|
The content of the message. |
tool_calls |
Optional[List[ToolCall]]
|
The tool calls of the message. |
prefix |
bool
|
Whether the message is a prefix. |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
BaseContentChunk(**data)
Bases: MistralBase
Base class for all content chunks.
Content chunks are used to send different types of content to the model.
Attributes:
Name | Type | Description |
---|---|---|
type |
Literal[text, image, image_url]
|
The type of the chunk. |
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
BaseMessage(**data)
Bases: MistralBase
Base class for all messages.
Attributes:
Name | Type | Description |
---|---|---|
role |
Literal[system, user, assistant, tool]
|
The role of the message. |
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
ChunkTypes
FinetuningAssistantMessage(**data)
Bases: AssistantMessage
Assistant message for finetuning.
Attributes:
Name | Type | Description |
---|---|---|
weight |
Optional[float]
|
The weight of the message to train on. |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
ImageChunk(**data)
Bases: BaseContentChunk
Image chunk.
Attributes:
Name | Type | Description |
---|---|---|
image |
SerializableImage
|
The image to be sent to the model. |
Examples:
>>> from PIL import Image
>>> image_chunk = ImageChunk(image=Image.new('RGB', (200, 200), color='blue'))
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
ImageURL(**data)
Bases: MistralBase
Image URL or a base64 encoded image.
Attributes:
Name | Type | Description |
---|---|---|
url |
str
|
The URL of the image. |
detail |
Optional[str]
|
The detail of the image. |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
ImageURLChunk(**data)
Bases: BaseContentChunk
Image URL chunk.
Attributes:
Name | Type | Description |
---|---|---|
image_url |
Union[ImageURL, str]
|
The URL of the image or a base64 encoded image to be sent to the model. |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
Roles
SystemMessage(**data)
Bases: BaseMessage
System message.
Attributes:
Name | Type | Description |
---|---|---|
content |
Union[str, List[ContentChunk]]
|
The content of the message. |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
TextChunk(**data)
Bases: BaseContentChunk
Text chunk.
Attributes:
Name | Type | Description |
---|---|---|
text |
str
|
The text to be sent to the model. |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
ToolMessage(**data)
Bases: BaseMessage
Tool message.
Attributes:
Name | Type | Description |
---|---|---|
content |
str
|
The content of the message. |
tool_call_id |
Optional[str]
|
The tool call id of the message. |
name |
Optional[str]
|
The name of the tool. (Deprecated in V3 tokenization) |
Examples:
Source code in .venv/lib/python3.13/site-packages/pydantic/main.py
UserMessage(**data)
Bases: BaseMessage
User message.
Attributes:
Name | Type | Description |
---|---|---|
content |
Union[str, List[ContentChunk]]
|
The content of the message. |
Examples: