pub struct BertBackend { /* private fields */ }Expand description
BERT-based embedding backend backed by candle_transformers::BertModel.
Implementations§
Source§impl BertBackend
impl BertBackend
Sourcepub async fn load(model_type: EmbeddingModelType) -> Result<Self>
pub async fn load(model_type: EmbeddingModelType) -> Result<Self>
Download (if needed) and load a BERT model + tokenizer from HuggingFace Hub.
Trait Implementations§
Source§impl EmbeddingBackend for BertBackend
impl EmbeddingBackend for BertBackend
Source§fn embedding_dimension(&self) -> usize
fn embedding_dimension(&self) -> usize
Dimension of the produced embedding vectors.
Source§fn is_bert_based(&self) -> bool
fn is_bert_based(&self) -> bool
Whether this backend runs a BERT-style model. BERT backends are routed
through the engine’s concurrency controller, timeout, and adaptive
batching machinery; non-BERT backends are invoked directly.
Source§fn process_batch<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn process_batch<'life0, 'async_trait>(
&'life0 self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Process a batch of texts and return one embedding vector per text.
The engine slices large inputs into chunks no larger than the engine’s
current_batch_size before calling this method.Auto Trait Implementations§
impl Freeze for BertBackend
impl !RefUnwindSafe for BertBackend
impl Send for BertBackend
impl Sync for BertBackend
impl Unpin for BertBackend
impl UnsafeUnpin for BertBackend
impl !UnwindSafe for BertBackend
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