anthropic.internal._anth_apply_cache_control

(internal) Anthropic places a cache breakpoint ON a content block, while a `${cache(args)}` in the prompt sits BETWEEN parts. The breakpoint goes on the last block lowered before the delimiter, so everything up to and including that block is the cached prefix, and `args` is the value of `cache_control`, as written.

Reference version

Signature

function anthropic.internal._anth_apply_cache_control(
cache_control: baml.json.json | null
) -> void throws never

(internal) Anthropic places a cache breakpoint ON a content block, while a ${cache(args)} in the prompt sits BETWEEN parts. The breakpoint goes on the last block lowered before the delimiter, so everything up to and including that block is the cached prefix, and args is the value of cache_control, as written.

Nothing is set when blocks is empty (there is no content before the delimiter in its message) or when args is null. A second delimiter with no block in between overwrites the first.

Source:<builtin>/anthropic/ns_internal/messages.bamlbytes 10501–11359