pub struct MockEmbedder { /* private fields */ }Expand description
Deterministic embedder for unit tests.
Generates consistent embeddings based on a hash of the input text. Same text always produces the same embedding. Output is normalized.
Implementations§
Source§impl MockEmbedder
impl MockEmbedder
Sourcepub fn new(dimensions: usize) -> MockEmbedder
pub fn new(dimensions: usize) -> MockEmbedder
Create a new MockEmbedder with the given dimensions.
Trait Implementations§
Source§impl Embedder for MockEmbedder
impl Embedder for MockEmbedder
Source§fn embed<'a>(
&'a self,
text: &'a str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, MemoryError>> + Send + 'a>>
fn embed<'a>( &'a self, text: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, MemoryError>> + Send + 'a>>
Embed a single text. Returns a vector of f32.
Source§fn embed_batch<'a>(
&'a self,
texts: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, MemoryError>> + Send + 'a>>
fn embed_batch<'a>( &'a self, texts: Vec<String>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, MemoryError>> + Send + 'a>>
Embed multiple texts in a batch. Read more
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
The model name this embedder uses.
Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Expected embedding dimensions.
Auto Trait Implementations§
impl Freeze for MockEmbedder
impl RefUnwindSafe for MockEmbedder
impl Send for MockEmbedder
impl Sync for MockEmbedder
impl Unpin for MockEmbedder
impl UnsafeUnpin for MockEmbedder
impl UnwindSafe for MockEmbedder
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