pub struct CacheConfig {
pub strategy: Option<CacheStrategy>,
pub ttl: Option<CacheTtl>,
pub tools_ttl: Option<CacheSectionSetting>,
pub system_prompt_ttl: Option<CacheSectionSetting>,
pub messages_ttl: Option<CacheSectionSetting>,
pub cache_key: Option<CacheKey>,
}Expand description
Prompt caching configuration (CacheConfig). Providers consume only the fields they support.
Fields§
§strategy: Option<CacheStrategy>Whether to skip caching for models that do not support it. Default CacheStrategy::Auto.
ttl: Option<CacheTtl>TTL for every cache point, overridden by a per-section TTL; the provider default when unset.
Bedrock requires checkpoint TTLs to be non-increasing across tools, system and messages, so this TTL also fills in for a cache point placed by hand in the system prompt that carries none. A TTL written on such a point is left as written.
tools_ttl: Option<CacheSectionSetting>Cache the tool definitions. A TTL sets this section’s duration; false disables it.
Default true.
system_prompt_ttl: Option<CacheSectionSetting>Cache the system prompt, adding a cache point at its end. A TTL sets this section’s
duration; true uses ttl; false disables it. Default true.
messages_ttl: Option<CacheSectionSetting>Cache the conversation prefix, on the last user message. A TTL sets this section’s
duration; false disables it. Default true.
cache_key: Option<CacheKey>Stable identity a prompt-cache-routing provider (OpenAI) uses as its cache key. Unset, it
is derived per request as strands-<sessionId> when the agent has a session manager. The
resolved key is sent to the provider.
Implementations§
Source§impl CacheConfig
impl CacheConfig
Sourcepub fn builder() -> CacheConfigBuilder
pub fn builder() -> CacheConfigBuilder
Create an instance of CacheConfig using the builder syntax
Trait Implementations§
Source§impl Clone for CacheConfig
impl Clone for CacheConfig
Source§impl Debug for CacheConfig
impl Debug for CacheConfig
Source§impl Default for CacheConfig
impl Default for CacheConfig
impl Eq for CacheConfig
Source§impl PartialEq for CacheConfig
impl PartialEq for CacheConfig
impl StructuralPartialEq for CacheConfig
Auto Trait Implementations§
impl Freeze for CacheConfig
impl RefUnwindSafe for CacheConfig
impl Send for CacheConfig
impl Sync for CacheConfig
impl Unpin for CacheConfig
impl UnsafeUnpin for CacheConfig
impl UnwindSafe for CacheConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more