pub struct NoopEmbedder {
dimension: usize,
modalities: Vec<Modality>,
}Expand description
No-op embedder that returns zero-vectors.
This embedder is always available, even without the candle feature.
It returns 384-dimensional zero-vectors for all inputs, making it useful
for testing and development.
§Example
use ragfs_embed::NoopEmbedder;
use ragfs_core::{Embedder, EmbeddingConfig};
let embedder = NoopEmbedder::new();
let config = EmbeddingConfig::default();
let texts: Vec<&str> = vec!["Hello", "World"];
let outputs = embedder.embed_text(&texts, &config).await?;
assert_eq!(outputs.len(), 2);
assert_eq!(outputs[0].embedding.len(), 384);
assert!(outputs[0].embedding.iter().all(|&v| v == 0.0));Fields§
§dimension: usize§modalities: Vec<Modality>Implementations§
Source§impl NoopEmbedder
impl NoopEmbedder
Sourcepub fn with_dimension(dimension: usize) -> Self
pub fn with_dimension(dimension: usize) -> Self
Create a new no-op embedder with custom dimension.
Trait Implementations§
Source§impl Default for NoopEmbedder
impl Default for NoopEmbedder
Source§impl Embedder for NoopEmbedder
impl Embedder for NoopEmbedder
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
Model name/identifier.
Source§fn max_tokens(&self) -> usize
fn max_tokens(&self) -> usize
Maximum tokens per input.
Source§fn modalities(&self) -> &[Modality]
fn modalities(&self) -> &[Modality]
Supported modalities.
Source§fn embed_text<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
_config: &'life3 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingOutput>, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn embed_text<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
texts: &'life1 [&'life2 str],
_config: &'life3 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddingOutput>, EmbedError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Embed text content.
Source§fn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_image_data: &'life1 [u8],
_config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn embed_image<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_image_data: &'life1 [u8],
_config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Embed image content.
Source§fn embed_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn embed_query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
query: &'life1 str,
config: &'life2 EmbeddingConfig,
) -> Pin<Box<dyn Future<Output = Result<EmbeddingOutput, EmbedError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Embed a query (may use different instruction).
Auto Trait Implementations§
impl Freeze for NoopEmbedder
impl RefUnwindSafe for NoopEmbedder
impl Send for NoopEmbedder
impl Sync for NoopEmbedder
impl Unpin for NoopEmbedder
impl UnwindSafe for NoopEmbedder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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