pub struct EmbeddingGenerator { /* private fields */ }Expand description
Simple embedding generator using hash-based approach for consistent vectors
Implementations§
Source§impl EmbeddingGenerator
impl EmbeddingGenerator
Sourcepub fn with_parallel_processing(
dimension: usize,
_parallel_processor: ParallelProcessor,
) -> Self
pub fn with_parallel_processing( dimension: usize, _parallel_processor: ParallelProcessor, ) -> Self
Create a new embedding generator with parallel processing support
Sourcepub fn generate_embedding(&mut self, text: &str) -> Vec<f32>
pub fn generate_embedding(&mut self, text: &str) -> Vec<f32>
Generate embedding for a text string
Sourcepub fn batch_generate(&mut self, texts: &[&str]) -> Vec<Vec<f32>>
pub fn batch_generate(&mut self, texts: &[&str]) -> Vec<Vec<f32>>
Generate embeddings for multiple texts in batch with parallel processing
Sourcepub fn batch_generate_chunked(
&mut self,
texts: &[&str],
chunk_size: usize,
) -> Vec<Vec<f32>>
pub fn batch_generate_chunked( &mut self, texts: &[&str], chunk_size: usize, ) -> Vec<Vec<f32>>
Parallel batch generation with chunking for very large datasets
Sourcepub fn cached_words(&self) -> usize
pub fn cached_words(&self) -> usize
Get the number of cached word vectors
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the word vector cache
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EmbeddingGenerator
impl RefUnwindSafe for EmbeddingGenerator
impl Send for EmbeddingGenerator
impl Sync for EmbeddingGenerator
impl Unpin for EmbeddingGenerator
impl UnsafeUnpin for EmbeddingGenerator
impl UnwindSafe for EmbeddingGenerator
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