Interface MessageModel<Role>

A single message in an LLM chat history. Covers all roles: system instructions, user input, assistant responses, and tool results.

interface MessageModel<Role extends MessageRole = MessageRole> {
    content: string;
    images?: string[] | Blob[] | Uint8Array<ArrayBufferLike>[];
    reasoning_content?: string;
    role: Role;
    tool_call_id?: string;
    tool_calls?: MessageToolCall[];
}

Type Parameters

Properties

content: string

Text content of the message. Empty string for assistant messages that only contain tool_calls.

images?: string[] | Blob[] | Uint8Array<ArrayBufferLike>[]

Images attached to the message. Supported as Blob, raw bytes, or base64 strings.

reasoning_content?: string

Chain-of-thought / reasoning exposed by some providers (e.g. DeepSeek).

role: Role

Sender role — determines how the message is interpreted by the model.

tool_call_id?: string

ID of the tool call this message is responding to. Present only on tool messages.

tool_calls?: MessageToolCall[]

Tool calls emitted by the assistant. Present only on assistant messages.