pub struct CandleEmbeddingEngine { /* private fields */ }Expand description
Pure-Rust embedding engine using candle for BERT inference.
Uses candle-transformers’ BERT implementation with tokenizers for tokenisation. No C/C++ FFI dependencies — compiles on all platforms.
Implementations§
Source§impl CandleEmbeddingEngine
impl CandleEmbeddingEngine
Sourcepub fn new() -> Result<Self, MemoryError>
pub fn new() -> Result<Self, MemoryError>
Initialise the candle embedding engine.
Downloads model weights from HuggingFace Hub on first use (cached
in the standard HF cache directory, respects HF_HOME).
Trait Implementations§
Source§impl EmbeddingBackend for CandleEmbeddingEngine
impl EmbeddingBackend for CandleEmbeddingEngine
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, MemoryError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed a batch of texts, returning one vector per input.
Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Number of dimensions produced by the model.
Auto Trait Implementations§
impl Freeze for CandleEmbeddingEngine
impl RefUnwindSafe for CandleEmbeddingEngine
impl Send for CandleEmbeddingEngine
impl Sync for CandleEmbeddingEngine
impl Unpin for CandleEmbeddingEngine
impl UnsafeUnpin for CandleEmbeddingEngine
impl UnwindSafe for CandleEmbeddingEngine
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