View Source Anthropic.CacheControl (anthropic_community v0.5.0)

Builds cache_control maps for prompt caching. Attach the result to a content block's :cache_control field (Anthropic.Messages.Content.{Text, Image, ToolUse, ToolResult}) to mark it as a cache breakpoint.

Examples

%Anthropic.Messages.Content.Text{text: large_system_prompt, cache_control: Anthropic.CacheControl.ephemeral()}
%Anthropic.Messages.Content.Text{text: large_system_prompt, cache_control: Anthropic.CacheControl.ephemeral(ttl: "1h")}

Summary

Functions

Builds an ephemeral cache_control map.

Functions

@spec ephemeral(keyword()) :: map()

Builds an ephemeral cache_control map.

Options

  • :ttl - Cache breakpoint time-to-live. Defaults to "5m" (the API's own default) when omitted.