aws.internal._takes_cache_point

(internal) Whether a `${cache(args)}` becomes a `cachePoint` block at this position. `lowered` is how many blocks its message has produced so far and `previous` is the `cachePoint` member of the last of them.

Reference version

Signature

function aws.internal._takes_cache_point(
previous: baml.json.json | null,
lowered: int,
delimiter: ai.CacheDelimiter
) -> bool throws never

(internal) Whether a ${cache(args)} becomes a cachePoint block at this position. lowered is how many blocks its message has produced so far and previous is the cachePoint member of the last of them.

  • Nothing lowered yet: there is no content before the delimiter to cache, and a cachePoint that leads a message is a ValidationException.
  • The last block is already a cachePoint: two in a row mark the same prefix, and each one counts against the four a request may carry.
  • Null args: there is no value to embed, and a null member is dropped from the body, which would leave an empty block behind. (ai.wire.prompt_parts has already given a ${cache()} the client's default, or removed it when there is none; this is the backstop.)

Source:<builtin>/aws/ns_internal/bedrock.bamlbytes 25772–25996