pub struct Qwen3EmbeddingProvider { /* private fields */ }Expand description
Qwen3-Embedding-0.6B provider — decoder-ONNX, last-token pooling, MRL-512.
Implementations§
Source§impl Qwen3EmbeddingProvider
impl Qwen3EmbeddingProvider
Sourcepub fn new(
model_path: impl Into<PathBuf>,
tokenizer_path: impl Into<PathBuf>,
) -> Self
pub fn new( model_path: impl Into<PathBuf>, tokenizer_path: impl Into<PathBuf>, ) -> Self
Create a provider pointing at model_fp16.onnx + tokenizer.json.
Degrades to Mock when the feature is off, files are missing, or loading fails — never panics, never requires the model to construct.
Sourcepub fn is_runtime_available(&self) -> bool
pub fn is_runtime_available(&self) -> bool
Whether real decoder-ONNX inference is active (vs. Mock fallback).
Sourcepub fn model_path(&self) -> &Path
pub fn model_path(&self) -> &Path
Path to the configured ONNX model file.
Sourcepub fn tokenizer_path(&self) -> &Path
pub fn tokenizer_path(&self) -> &Path
Path to the configured tokenizer file.
Sourcepub async fn embed_query(&self, query: &str) -> Result<Vec<f32>, EmbeddingError>
pub async fn embed_query(&self, query: &str) -> Result<Vec<f32>, EmbeddingError>
Embed a query (asymmetric lane): prepends the Qwen3 instruction prefix.
Trait Implementations§
Source§impl EmbeddingProvider for Qwen3EmbeddingProvider
impl EmbeddingProvider for Qwen3EmbeddingProvider
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,
Asymmetric query lane — delegates to the inherent
Self::embed_query so trait-object call sites
(SessionView::graft_text) get the instruction prefix.
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 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 Qwen3EmbeddingProvider
impl RefUnwindSafe for Qwen3EmbeddingProvider
impl Send for Qwen3EmbeddingProvider
impl Sync for Qwen3EmbeddingProvider
impl Unpin for Qwen3EmbeddingProvider
impl UnsafeUnpin for Qwen3EmbeddingProvider
impl UnwindSafe for Qwen3EmbeddingProvider
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