pub struct StaticHashBackend { /* private fields */ }Expand description
Fallback embedding backend — hashes the input bytes into a deterministic pseudo-embedding of the configured dimension.
Used when the BERT backend is unavailable (e.g. the bert feature
is disabled or the HuggingFace Hub model cache cannot be reached).
The output is not semantically meaningful — it just provides
stable vectors for tests and offline development.
Trait Implementations§
Source§impl EmbeddingBackend for StaticHashBackend
impl EmbeddingBackend for StaticHashBackend
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 StaticHashBackend
impl RefUnwindSafe for StaticHashBackend
impl Send for StaticHashBackend
impl Sync for StaticHashBackend
impl Unpin for StaticHashBackend
impl UnsafeUnpin for StaticHashBackend
impl UnwindSafe for StaticHashBackend
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