pub struct PromptCacheRequest {
pub mode: PromptCacheMode,
pub strategy: PromptCacheStrategy,
pub retention: Option<PromptCacheRetention>,
pub key: Option<String>,
}Expand description
Prompt caching request sent alongside a turn.
Fields§
§mode: PromptCacheModeStrength of the caching request.
strategy: PromptCacheStrategyAutomatic or explicit caching strategy.
retention: Option<PromptCacheRetention>Optional provider-neutral retention hint.
key: Option<String>Optional provider cache key or routing key.
Implementations§
Source§impl PromptCacheRequest
impl PromptCacheRequest
Sourcepub fn automatic_required() -> Self
pub fn automatic_required() -> Self
Builds a required automatic cache request.
Sourcepub fn explicit(
breakpoints: impl IntoIterator<Item = PromptCacheBreakpoint>,
) -> Self
pub fn explicit( breakpoints: impl IntoIterator<Item = PromptCacheBreakpoint>, ) -> Self
Builds a best-effort explicit cache request.
Sourcepub fn explicit_required(
breakpoints: impl IntoIterator<Item = PromptCacheBreakpoint>,
) -> Self
pub fn explicit_required( breakpoints: impl IntoIterator<Item = PromptCacheBreakpoint>, ) -> Self
Builds a required explicit cache request.
Sourcepub fn best_effort(strategy: PromptCacheStrategy) -> Self
pub fn best_effort(strategy: PromptCacheStrategy) -> Self
Builds a best-effort cache request with the given strategy.
Sourcepub fn required(strategy: PromptCacheStrategy) -> Self
pub fn required(strategy: PromptCacheStrategy) -> Self
Builds a required cache request with the given strategy.
Sourcepub fn with_mode(self, mode: PromptCacheMode) -> Self
pub fn with_mode(self, mode: PromptCacheMode) -> Self
Overrides the request mode.
Sourcepub fn with_strategy(self, strategy: PromptCacheStrategy) -> Self
pub fn with_strategy(self, strategy: PromptCacheStrategy) -> Self
Overrides the request strategy.
Sourcepub fn with_retention(self, retention: PromptCacheRetention) -> Self
pub fn with_retention(self, retention: PromptCacheRetention) -> Self
Applies a provider-neutral retention hint.
Sourcepub fn with_key(self, key: impl Into<String>) -> Self
pub fn with_key(self, key: impl Into<String>) -> Self
Applies a provider cache key or routing key.
Sourcepub fn without_retention(self) -> Self
pub fn without_retention(self) -> Self
Clears any provider-neutral retention hint.
Sourcepub fn without_key(self) -> Self
pub fn without_key(self) -> Self
Clears any provider cache key or routing key.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true when caching should be active for this request.
Trait Implementations§
Source§impl Clone for PromptCacheRequest
impl Clone for PromptCacheRequest
Source§fn clone(&self) -> PromptCacheRequest
fn clone(&self) -> PromptCacheRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PromptCacheRequest
impl Debug for PromptCacheRequest
Source§impl Default for PromptCacheRequest
impl Default for PromptCacheRequest
Source§fn default() -> PromptCacheRequest
fn default() -> PromptCacheRequest
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PromptCacheRequest
impl<'de> Deserialize<'de> for PromptCacheRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PromptCacheRequest
impl PartialEq for PromptCacheRequest
Source§impl Serialize for PromptCacheRequest
impl Serialize for PromptCacheRequest
impl Eq for PromptCacheRequest
impl StructuralPartialEq for PromptCacheRequest
Auto Trait Implementations§
impl Freeze for PromptCacheRequest
impl RefUnwindSafe for PromptCacheRequest
impl Send for PromptCacheRequest
impl Sync for PromptCacheRequest
impl Unpin for PromptCacheRequest
impl UnsafeUnpin for PromptCacheRequest
impl UnwindSafe for PromptCacheRequest
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
Mutably borrows from an owned value. Read more