pub struct EmbeddingManager { /* private fields */ }Expand description
Manages embedding generation with caching.
Implementations§
Source§impl EmbeddingManager
impl EmbeddingManager
Sourcepub fn new(provider: Box<dyn EmbeddingProvider>, cache_size: usize) -> Self
pub fn new(provider: Box<dyn EmbeddingProvider>, cache_size: usize) -> Self
Create a new embedding manager with the given provider and cache size.
Sourcepub fn embed(&mut self, text: &str) -> MenteResult<Vec<f32>>
pub fn embed(&mut self, text: &str) -> MenteResult<Vec<f32>>
Generate an embedding for the given text, using the cache when possible.
Sourcepub fn embed_batch(&mut self, texts: &[&str]) -> MenteResult<Vec<Vec<f32>>>
pub fn embed_batch(&mut self, texts: &[&str]) -> MenteResult<Vec<Vec<f32>>>
Generate embeddings for a batch of texts, using the cache for already-computed ones.
Sourcepub fn embed_memory(&mut self, node: &mut MemoryNode) -> MenteResult<()>
pub fn embed_memory(&mut self, node: &mut MemoryNode) -> MenteResult<()>
Embed a memory node’s content and set its embedding field.
Sourcepub fn stats(&self) -> EmbeddingStats
pub fn stats(&self) -> EmbeddingStats
Get statistics about embedding operations.
Sourcepub fn dimensions(&self) -> usize
pub fn dimensions(&self) -> usize
Get the dimensionality of the underlying provider.
Sourcepub fn model_name(&self) -> &str
pub fn model_name(&self) -> &str
Get the model name of the underlying provider.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the embedding cache.
Auto Trait Implementations§
impl Freeze for EmbeddingManager
impl !RefUnwindSafe for EmbeddingManager
impl Send for EmbeddingManager
impl Sync for EmbeddingManager
impl Unpin for EmbeddingManager
impl UnsafeUnpin for EmbeddingManager
impl !UnwindSafe for EmbeddingManager
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