pub struct LocalEmbeddingEngine { /* private fields */ }Expand description
Local embedding engine.
Implementations§
Source§impl LocalEmbeddingEngine
impl LocalEmbeddingEngine
Sourcepub async fn new(config: EmbeddingConfig) -> Result<Self>
pub async fn new(config: EmbeddingConfig) -> Result<Self>
Create a new embedding engine with the given configuration.
Sourcepub fn current_batch_size(&self) -> usize
pub fn current_batch_size(&self) -> usize
Get current batch size.
Sourcepub fn embedding_dimension(&self) -> usize
pub fn embedding_dimension(&self) -> usize
Get embedding dimension.
Sourcepub fn is_bert_based(&self) -> bool
pub fn is_bert_based(&self) -> bool
Check if the active backend is BERT-based.
Sourcepub async fn encode_text(&self, text: &str) -> Result<Vec<f32>>
pub async fn encode_text(&self, text: &str) -> Result<Vec<f32>>
Encode a single text into an embedding.
Sourcepub async fn encode_batch(&self, texts: Vec<String>) -> Result<Vec<Vec<f32>>>
pub async fn encode_batch(&self, texts: Vec<String>) -> Result<Vec<Vec<f32>>>
Encode a batch of texts into embeddings.
Sourcepub fn current_concurrency_load(&self) -> usize
pub fn current_concurrency_load(&self) -> usize
Get current concurrency load.
Sourcepub fn get_concurrency_stats(&self) -> (usize, usize)
pub fn get_concurrency_stats(&self) -> (usize, usize)
Get concurrency stats: (current_load, max_capacity).
Auto Trait Implementations§
impl !Freeze for LocalEmbeddingEngine
impl !RefUnwindSafe for LocalEmbeddingEngine
impl Send for LocalEmbeddingEngine
impl Sync for LocalEmbeddingEngine
impl Unpin for LocalEmbeddingEngine
impl UnsafeUnpin for LocalEmbeddingEngine
impl !UnwindSafe for LocalEmbeddingEngine
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