API Reference
UserMessage
Defined in: types/user-message.ts:40
A user turn.
Remarks
The only role whose content may be multimodal: a plain string, or an array
of ContentParts (text / image / audio / file). That mirrors the
chat-completions spec, where images, audio, and files are input-only and ride
on user turns; the array passes straight through egress to the provider.
Abstraction over — OpenAI's user message ({ role, content }), where
content is a string or a ContentPart array; timestamp is the only
extension. The multimodal array crosses egress unchanged.
Example
Wire shape — plain text, then multimodal
{ "role": "user", "content": "What's the weather in NYC?" }{
"role": "user",
"content": [
{ "type": "text", "text": "What's in this image?" },
{ "type": "image_url", "image_url": { "url": "https://example.com/a.png" } }
]
}Extends
MessageBase
Properties
| Property | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|
content | string | ContentPart[] | Plain text, or a multimodal ContentPart array. | MessageBase.content | - | types/user-message.ts:44 |
role | User | Discriminant: a user turn. | - | - | types/user-message.ts:42 |
timestamp? | number | [extension — not in the OpenAI spec] Creation time (ms since epoch), for ordering. | - | MessageBase.timestamp | types/message-base.ts:35 |