pub struct PromptCachePlan {
pub cache_tools: bool,
pub cache_system: bool,
pub breakpoint_message_ids: Vec<String>,
pub ttl: CacheTtl,
}Expand description
Provider-agnostic description of which logical regions of a request form a stable, cacheable prefix.
Breakpoints are identified by message id rather than position so the plan survives provider-side message reshaping — for example, Anthropic merges consecutive tool-result messages into the preceding user message, which would invalidate positional indices.
Fields§
§cache_tools: boolCache the tool-definition block (stable for the whole session).
cache_system: boolCache the system prompt. Only set this when the system prompt is free of per-round volatile content (the engine guarantees this by moving volatile context blocks to the conversation tail).
breakpoint_message_ids: Vec<String>Ids of messages that end a stable prefix; each becomes a cache breakpoint. Order is not significant.
ttl: CacheTtlTTL hint for providers that support it.
Implementations§
Source§impl PromptCachePlan
impl PromptCachePlan
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
True when the plan asks for at least one cache breakpoint.
Sourcepub fn is_breakpoint(&self, message_id: &str) -> bool
pub fn is_breakpoint(&self, message_id: &str) -> bool
Whether the given message id is marked as a cache breakpoint.
Trait Implementations§
Source§impl Clone for PromptCachePlan
impl Clone for PromptCachePlan
Source§fn clone(&self) -> PromptCachePlan
fn clone(&self) -> PromptCachePlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more