ai.PromptMessage
A single chat message in a rendered prompt.
Reference version
Signature
class ai.PromptMessageA single chat message in a rendered prompt.
Source:<builtin>/ai/spec.bamlbytes 3226–3964
Fields
role
stringThe chat role, e.g. "system", "user", or "assistant". Empty for role-less content.
content
stringThe message's rendered text. Media parts use a readable placeholder; a cache delimiter contributes nothing.
parts
ai.PromptPart[]Ordered structural content. Provider clients use this instead of the
readable content projection so media survives prompt rendering.
metadata
map<string, baml.json.json>Free-form per-message data, carried verbatim from the
ai.Role.metadata of the ${role(...)} marker that opened this
message. Empty when the message carried none. The built-in clients do
not read it.