pub struct EmbeddingModel { /* private fields */ }Expand description
Embedding model for generating semantic embeddings
Implementations§
Source§impl EmbeddingModel
impl EmbeddingModel
Sourcepub async fn new(config: EmbeddingConfig) -> Result<Self>
pub async fn new(config: EmbeddingConfig) -> Result<Self>
Create new embedding model with real Candle inference
Sourcepub fn encode(&mut self, text: &str) -> Result<Embedding>
pub fn encode(&mut self, text: &str) -> Result<Embedding>
Generate embedding for a single text using TRUE BERT neural network inference
Sourcepub fn encode_batch(&mut self, texts: &[String]) -> Result<Vec<Embedding>>
pub fn encode_batch(&mut self, texts: &[String]) -> Result<Vec<Embedding>>
Generate embeddings for multiple texts
Sourcepub fn encode_batch_parallel(
&mut self,
texts: &[String],
) -> Result<(Vec<Embedding>, Vec<String>)>
pub fn encode_batch_parallel( &mut self, texts: &[String], ) -> Result<(Vec<Embedding>, Vec<String>)>
Generate embeddings for multiple texts with parallel processing and error recovery
Sourcepub fn encode_batch_with_retry(
&mut self,
texts: &[String],
max_retries: usize,
retry_delay_ms: u64,
) -> Result<(Vec<Embedding>, Vec<String>, usize)>
pub fn encode_batch_with_retry( &mut self, texts: &[String], max_retries: usize, retry_delay_ms: u64, ) -> Result<(Vec<Embedding>, Vec<String>, usize)>
Batch encoding with retry logic and graceful error handling
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the embedding cache
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Get cache size
Sourcepub fn config(&self) -> &EmbeddingConfig
pub fn config(&self) -> &EmbeddingConfig
Get model configuration
Sourcepub fn has_tokenizer(&self) -> bool
pub fn has_tokenizer(&self) -> bool
Check if real tokenizer is loaded
Sourcepub fn health_check(&self) -> EmbeddingHealth
pub fn health_check(&self) -> EmbeddingHealth
Get embedding model health status
Sourcepub fn clear_cache_selective(&mut self, keep_recent: Option<usize>)
pub fn clear_cache_selective(&mut self, keep_recent: Option<usize>)
Clear cache with optional size limit
Sourcepub fn cache_stats(&self) -> CacheStats
pub fn cache_stats(&self) -> CacheStats
Get cache statistics
Auto Trait Implementations§
impl !Freeze for EmbeddingModel
impl !RefUnwindSafe for EmbeddingModel
impl Send for EmbeddingModel
impl Sync for EmbeddingModel
impl Unpin for EmbeddingModel
impl UnsafeUnpin for EmbeddingModel
impl !UnwindSafe for EmbeddingModel
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.