pub struct RagChunkCache { /* private fields */ }Expand description
RAG chunk cache
Implementations§
Source§impl RagChunkCache
impl RagChunkCache
Sourcepub fn get_chunks_by_embedding(&self, embedding: &[f32], k: usize) -> Vec<Chunk>
pub fn get_chunks_by_embedding(&self, embedding: &[f32], k: usize) -> Vec<Chunk>
Get chunks by embedding similarity
Sourcepub fn get_document_chunks(&self, document_id: &str) -> Vec<Chunk>
pub fn get_document_chunks(&self, document_id: &str) -> Vec<Chunk>
Get all chunks for a document
Sourcepub fn insert_chunk(&self, chunk: Chunk)
pub fn insert_chunk(&self, chunk: Chunk)
Insert a chunk
Sourcepub fn insert_chunks(&self, chunks: Vec<Chunk>)
pub fn insert_chunks(&self, chunks: Vec<Chunk>)
Insert multiple chunks (batch)
Sourcepub fn cache_embedding_result(&self, embedding: &[f32], chunk_ids: Vec<ChunkId>)
pub fn cache_embedding_result(&self, embedding: &[f32], chunk_ids: Vec<ChunkId>)
Cache embedding to chunk ID mapping
Sourcepub fn remove_chunk(&self, id: ChunkId)
pub fn remove_chunk(&self, id: ChunkId)
Remove a chunk
Sourcepub fn remove_document(&self, document_id: &str)
pub fn remove_document(&self, document_id: &str)
Remove all chunks for a document
Sourcepub fn stats(&self) -> RagCacheStatsSnapshot
pub fn stats(&self) -> RagCacheStatsSnapshot
Get cache statistics
Auto Trait Implementations§
impl !Freeze for RagChunkCache
impl !RefUnwindSafe for RagChunkCache
impl Send for RagChunkCache
impl Sync for RagChunkCache
impl Unpin for RagChunkCache
impl UnsafeUnpin for RagChunkCache
impl UnwindSafe for RagChunkCache
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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