Skip to content

cayu.providers.cache

Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.

from cayu.providers import CacheBreakpoint

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
SYSTEM_PROMPT class attribute 'system_prompt'
TOOL_DEFINITIONS class attribute 'tool_definitions'
CONVERSATION_PREFIX class attribute 'conversation_prefix'

Release source · Runtime guarantees · Capability guides

from cayu.providers import CachePolicy

Controls prompt cache_control marker placement for the Anthropic provider.

A breakpoint marks the end of a stable, cacheable prefix. The default caches the system prompt and tool definitions, the two blocks that stay constant across the turns of a session. The model and marker format are Anthropic-Messages-shaped, so a future Bedrock/Vertex provider can reuse this policy when it lands.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
breakpoints tuple[CacheBreakpoint, ...] (CacheBreakpoint.SYSTEM_PROMPT, CacheBreakpoint.TOOL_DEFINITIONS)
conversation_prefix_strategy Literal['all_but_last', 'all_but_last_n', 'none'] 'all_but_last'
conversation_prefix_n StrictInt Field(default=1, ge=1)
ttl Literal['standard', 'extended'] | None None
CachePolicy.uses_extended_ttl() -> bool
CachePolicy.marker() -> dict[str, str]

Release source · Runtime guarantees · Capability guides

from cayu.providers import RequestCacheProjection

Ephemeral provider-owned cache evidence for one prepared request.

conversation_prefix contains only the projected message material through the marker the adapter actually applied. The runtime may fingerprint this value, but it never persists the value itself.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
policy CachePolicy required
conversation_prefix tuple[dict[str, Any], ...] | None None
RequestCacheProjection.copy_conversation_prefix(value: object) -> object
RequestCacheProjection.validate_conversation_prefix() -> RequestCacheProjection

Release source · Runtime guarantees · Capability guides