pub struct E5EmbeddingProvider { /* private fields */ }Expand description
e5-small-v2 provider — 384-d BERT encoder with asymmetric query/passage prefixes.
Implementations§
Source§impl E5EmbeddingProvider
impl E5EmbeddingProvider
Sourcepub fn new(model_path: impl Into<PathBuf>) -> Self
pub fn new(model_path: impl Into<PathBuf>) -> Self
Create a provider pointing at an e5 ONNX model file.
Degrades to the ONNX hash fallback when the feature is off, the file is missing, or session load fails — never panics, never requires the model to construct (CI-safe).
Sourcepub fn is_runtime_available(&self) -> bool
pub fn is_runtime_available(&self) -> bool
Whether real ONNX inference is active (vs. hash fallback).
Sourcepub fn model_path(&self) -> &Path
pub fn model_path(&self) -> &Path
Path to the configured ONNX model file.
Sourcepub fn prefix_passage(text: &str) -> String
pub fn prefix_passage(text: &str) -> String
Prefix a string for the passage (document) lane.
Sourcepub fn prefix_query(text: &str) -> String
pub fn prefix_query(text: &str) -> String
Prefix a string for the query lane.
Trait Implementations§
Source§impl EmbeddingProvider for E5EmbeddingProvider
impl EmbeddingProvider for E5EmbeddingProvider
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed a single text chunk into a vector.
Source§fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn embed_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Embed a batch of text chunks. Read more
Source§fn embed_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed_query<'life0, 'life1, 'async_trait>(
&'life0 self,
query: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbeddingError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Embed a query (asymmetric retrieval lane). Read more
Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Dimensionality of the output vectors.
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
Name of the embedding model (for metadata tracking).
Source§fn warm<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn warm<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pre-warm the backend: run one throwaway
embed so the
model graph, runtime thread pool, and allocator are hot before the first
real call. Best-effort — errors are swallowed (a backend with nothing to
warm, like the Mock, just pays one cheap call). Intended to be called
once at daemon startup so the first conversation turn doesn’t pay the
model’s first-inference cost (ADR-058 Phase 5.3; mirrors the 6.2 STT
pre-warm).Auto Trait Implementations§
impl Freeze for E5EmbeddingProvider
impl RefUnwindSafe for E5EmbeddingProvider
impl Send for E5EmbeddingProvider
impl Sync for E5EmbeddingProvider
impl Unpin for E5EmbeddingProvider
impl UnsafeUnpin for E5EmbeddingProvider
impl UnwindSafe for E5EmbeddingProvider
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