pub struct EmbeddingCache { /* private fields */ }Expand description
Embedding cache with compression and deduplication
Implementations§
Source§impl EmbeddingCache
impl EmbeddingCache
Sourcepub fn new(config: EmbeddingCacheConfig) -> RragResult<Self>
pub fn new(config: EmbeddingCacheConfig) -> RragResult<Self>
Create new embedding cache
Sourcepub fn get_embedding(&self, text: &str, model: &str) -> Option<Vec<f32>>
pub fn get_embedding(&self, text: &str, model: &str) -> Option<Vec<f32>>
Get embedding with automatic decompression
Sourcepub fn cache_embedding(
&mut self,
text: String,
model: String,
embedding: Vec<f32>,
) -> RragResult<()>
pub fn cache_embedding( &mut self, text: String, model: String, embedding: Vec<f32>, ) -> RragResult<()>
Cache embedding with compression and deduplication
Sourcepub fn get_deduplication_stats(&self) -> DeduplicationStats
pub fn get_deduplication_stats(&self) -> DeduplicationStats
Get deduplication statistics
Sourcepub fn get_compression_stats(&self) -> Option<CompressionStats>
pub fn get_compression_stats(&self) -> Option<CompressionStats>
Get compression statistics
Trait Implementations§
Source§impl Cache<String, EmbeddingCacheEntry> for EmbeddingCache
impl Cache<String, EmbeddingCacheEntry> for EmbeddingCache
Source§fn put(&mut self, key: String, value: EmbeddingCacheEntry) -> RragResult<()>
fn put(&mut self, key: String, value: EmbeddingCacheEntry) -> RragResult<()>
Put value into cache
Source§fn stats(&self) -> CacheStats
fn stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl Freeze for EmbeddingCache
impl RefUnwindSafe for EmbeddingCache
impl Send for EmbeddingCache
impl Sync for EmbeddingCache
impl Unpin for EmbeddingCache
impl UnwindSafe for EmbeddingCache
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