Overview
AMessageType
consists of three main components:
The role of the message sender.Constraints: Must be one of the defined roles.
Array of content items.Constraints: Must contain at least one content item.
Role Types
Therole
field uses a union of predefined roles that determine the sender of the message.
RoleEnumType
Messages from the system.Usage: Used for system prompts and instructions.
Messages from the user.Usage: User input and queries.
Messages from the assistant.Usage: LLM responses and outputs.
Messages from a tool.Usage: Tool execution results.
Content Types
Thecontent
field contains an array of ContentType
items, which is a union based on the modality
field. Each content type supports different data formats and use cases.
ContentType Discriminated Union
TheContentType
is discriminated by the modality
field:
Plain text content.
Image content with various formats.
Function/tool call requests.
Tool execution responses.
LLM reasoning and thinking content.
Text Content
TextContentType
Represents plain text content in messages.Content type discriminator.Constraints: Must be
"text"
.The text content.Constraints: Any valid string.
Image Content
ImageContentType
Represents image content with support for both base64-encoded images and URL references.Content type discriminator.Constraints: Must be
"image"
.Processing detail level.Constraints: Must be
"low"
, "medium"
, "high"
, or "auto"
Image data.Constraints: Must be either Base64 or URL type
ImageContentDetailsLiteralType
Controls how the image should be processed by the LLM:Low detail processing (faster, less accurate).
Medium detail processing.
High detail processing (slower, more accurate).
Automatic detail selection.
ImageContentValueType Discriminated Union
Thevalue
field in ImageContentType
is itself a discriminated union based on the type
field:
Base64ImageContentValueType
For inline base64-encoded images:Value type discriminator.Constraints: Must be
"base64"
Base64-encoded image data.Constraints: Valid base64 string.
Image format.Constraints: Must be
"png"
, "jpeg"
, "webp"
, or "gif"
UrlImageContentValueType
For images referenced by URL:Value type discriminator.Constraints: Must be
"url"
URL pointing to the image.Constraints: Valid URL string
Tool Call Content
ToolCallContentType
Represents a function or tool call request from the LLM.Content type discriminator.Constraints: Must be
"tool-call"
.Tool call index.Constraints: Non-negative integer.
Unique identifier for the tool call.Constraints: Non-empty string.
Name of the tool being called.Constraints: Non-empty string.
JSON string of tool arguments.Constraints: Valid string (typically JSON).
Tool Response Content
ToolResponseContentType
Represents the response from a tool execution.Content type discriminator.Constraints: Must be
"tool-response"
.Tool response index.Constraints: Non-negative integer.
Tool call identifier.Constraints: Non-empty string (matches tool call ID).
Name of the tool that was called.Constraints: Non-empty string.
Response data from the tool.Constraints: Any valid string.
Reasoning Content
ReasoningContentType
Represents LLM reasoning and thinking processes, supporting both full reasoning and redacted content.Content type discriminator.Constraints: Must be
"reasoning"
.Reasoning data.Constraints: Must be thinking or redacted type.
ReasoningContentValueUnionType Discriminated Union
Thevalue
field is discriminated by the type
field:
ReasoningContentValueType
For full reasoning content:Value type discriminator.Constraints: Must be
"thinking"
.The reasoning/thinking text.Constraints: Any valid string.
Signature for the reasoning.Constraints: Any valid string.
RedactedReasoningContentValueType
For redacted reasoning content:Value type discriminator.Constraints: Must be
"redacted"
.Redacted data placeholder.Constraints: Any valid string