ai.events.UserMessage

A user turn: text and media, in order. The runner records the opening turn; a runner that observes its environment appends more mid-run (a screenshot after a tool ran, a document the host attaches), and every client lowers the turn at its position in the journal.

Reference version

Signature

class ai.events.UserMessage

A user turn: text and media, in order. The runner records the opening turn; a runner that observes its environment appends more mid-run (a screenshot after a tool ran, a document the host attaches), and every client lowers the turn at its position in the journal.

Source:<builtin>/ai/ns_events/events.bamlbytes 5081502

Fields

metadata

map<string, baml.json.json>

Per-message provider directives, carried verbatim like root.PromptMessage.metadata (Anthropic cache_control, for example).

Static methods

function

new

(text: string) -> ai.events.UserMessage
function

of

(
items: (string | image | audio | video | pdf | ai.content.Text | ai.content.Media)[],
metadata: map<string, baml.json.json> = …
) -> ai.events.UserMessage

A turn from ordinary values: text, the image / audio / video / pdf primitives, or blocks already built (see root.content.blocks).

Instance methods

function

text

(self) -> string

The Text blocks joined; a media block contributes a [image]-style placeholder.