#[non_exhaustive]pub struct PromptCacheConfig {
pub enabled: bool,
pub default_ttl: CacheTtl,
pub auto_breakpoints: bool,
pub min_system_tokens: usize,
}Expand description
Prompt caching configuration.
Controls automatic placement of cache breakpoints in the context
pipeline. Active only when the provider advertises prompt_caching = true in ProviderCapabilities.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.enabled: boolMaster switch. When false, the context pipeline never adds cache
markers regardless of the per-adapter settings. Default: true.
default_ttl: CacheTtlDefault TTL for automatically placed cache breakpoints.
Default: CacheTtl::FiveMinutes.
auto_breakpoints: boolWhen true, the context pipeline automatically inserts cache
markers at three stable regions (system end, tools end,
conversation tail). When false, only explicit per-ContentPart
markers from adapters are honored. Default: true.
min_system_tokens: usizeMinimum estimated system-prompt token count before the system-end
breakpoint is placed. Avoids wasting cache writes on tiny prompts.
Default: 1024.
Implementations§
Source§impl PromptCacheConfig
impl PromptCacheConfig
Sourcepub fn with_default_ttl(self, ttl: CacheTtl) -> Self
pub fn with_default_ttl(self, ttl: CacheTtl) -> Self
Sets the default TTL for auto-placed cache markers.
Sourcepub fn with_auto_breakpoints(self, enabled: bool) -> Self
pub fn with_auto_breakpoints(self, enabled: bool) -> Self
Sets whether to auto-place cache breakpoints.
Sourcepub fn with_min_system_tokens(self, tokens: usize) -> Self
pub fn with_min_system_tokens(self, tokens: usize) -> Self
Sets the minimum system-prompt token count for the system breakpoint.
Trait Implementations§
Source§impl Clone for PromptCacheConfig
impl Clone for PromptCacheConfig
Source§fn clone(&self) -> PromptCacheConfig
fn clone(&self) -> PromptCacheConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more