applyAnthropicCacheControl
function applyAnthropicCacheControl(messages, ttl?): ModelMessage[];Returns a SHALLOW-COPIED message list with cache_control markers applied to the system message (if present) + the last 3 non-system messages. Original input is not mutated.
When messages has no system message, only the last 3 non-system
messages get breakpoints. When fewer than 3 non-system messages
exist, all of them get breakpoints (Anthropic accepts <4 fine).
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
|
|
|
Returns
Section titled “Returns”ModelMessage[]