Message Formats

Use structured multimodal messages for robust model behavior.

Input Variants

Text
input: [{ role: "user", content: "Explain canary deploys." }]

Message Schema

NameTypeRequiredDescription
role
stringRequiredsystem | user | assistant | tool
content
string | arrayRequiredText string or typed content blocks.
name
stringOptional participant name.
tool_call_id
stringTool 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.