ai.wire.prompt_parts
A rendered prompt message's parts for a client that SENDS cache delimiters: the same parts as `message.parts`, with each delimiter made a clean boundary between two content blocks.
Reference version
Signature
function ai.wire.prompt_parts(
message: ai.PromptMessage,
default_cache_args: baml.json.json = …
) -> ai.PromptPart[] throws never
A rendered prompt message's parts for a client that SENDS cache delimiters:
the same parts as message.parts, with each delimiter made a clean
boundary between two content blocks.
- Text directly before a delimiter is end-trimmed and text directly after one is start-trimmed, and a part left empty is dropped — the treatment text around a media part already gets. The marker sits between two blocks on the wire, so the whitespace that separated them in the template has no block to belong to.
- A delimiter whose
argsis null (${cache()}) takesdefault_cache_args, which the caller passes from its client'sdefault_cache_args(). The delimiter returned carries the resolved value, so the caller never sees a nullargs. - When that default is null too, the delimiter is removed and the text around it is joined, untrimmed: there is nothing to send for it, so it is as if it had not been written.
What the caller does with a delimiter is its own business (a sibling block,
a field on the block before); the positions are as written, and so is every
args that was not null.
Source:<builtin>/ai/ns_wire/wire.bamlbytes 20892–23090