pub struct AnthropicPromptCachingMiddleware {
pub ttl: String,
pub unsupported_model_behavior: String,
}
Expand description
Anthropic-specific prompt caching middleware. Marks system prompts for caching to reduce latency on subsequent requests with the same base prompt.
Fields§
§ttl: String
§unsupported_model_behavior: String
Implementations§
Trait Implementations§
Source§impl AgentMiddleware for AnthropicPromptCachingMiddleware
impl AgentMiddleware for AnthropicPromptCachingMiddleware
Source§fn modify_model_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MiddlewareContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn modify_model_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MiddlewareContext<'life2>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Apply middleware-specific mutations to the pending model request.
Source§fn before_tool_execution<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_tool_name: &'life1 str,
_tool_args: &'life2 Value,
_call_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentInterrupt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn before_tool_execution<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_tool_name: &'life1 str,
_tool_args: &'life2 Value,
_call_id: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentInterrupt>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Hook called before tool execution - can return an interrupt to pause execution. Read more
Auto Trait Implementations§
impl Freeze for AnthropicPromptCachingMiddleware
impl RefUnwindSafe for AnthropicPromptCachingMiddleware
impl Send for AnthropicPromptCachingMiddleware
impl Sync for AnthropicPromptCachingMiddleware
impl Unpin for AnthropicPromptCachingMiddleware
impl UnwindSafe for AnthropicPromptCachingMiddleware
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