pub struct CachedProvider<P> { /* private fields */ }Expand description
A wrapper that adds caching functionality to any LLM provider
Implementations§
Source§impl<P> CachedProvider<P>
impl<P> CachedProvider<P>
Sourcepub fn new(provider: P, model_name: String) -> Self
pub fn new(provider: P, model_name: String) -> Self
Create a new CachedProvider with default cache settings
Sourcepub fn with_cache(provider: P, model_name: String, cache: LlmCache) -> Self
pub fn with_cache(provider: P, model_name: String, cache: LlmCache) -> Self
Create a new CachedProvider with a custom cache
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get cache statistics
Trait Implementations§
Source§impl<P: LlmProvider> LlmProvider for CachedProvider<P>
impl<P: LlmProvider> LlmProvider for CachedProvider<P>
fn complete<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<P> Freeze for CachedProvider<P>where
P: Freeze,
impl<P> RefUnwindSafe for CachedProvider<P>where
P: RefUnwindSafe,
impl<P> Send for CachedProvider<P>where
P: Send,
impl<P> Sync for CachedProvider<P>where
P: Sync,
impl<P> Unpin for CachedProvider<P>where
P: Unpin,
impl<P> UnwindSafe for CachedProvider<P>where
P: UnwindSafe,
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