Message Formats
Use structured multimodal messages for robust model behavior.
Input Variants
Text
input: [{ role: "user", content: "Explain canary deploys." }]Message Schema
| Name | Type | Required | Description |
|---|---|---|---|
role | string | Required | system | user | assistant | tool |
content | string | array | Required | Text string or typed content blocks. |
name | string | Optional participant name. | |
tool_call_id | string | Tool response correlation ID. |
Canonical Message Helper
message-helper.ts
export const userText = (text: string) => ({ role: "user", content: text });Typed blocks
Prefer typed content blocks when mixing text, images, audio, or tool metadata in the same turn.