pub struct MockEmbedder { /* private fields */ }Expand description
Deterministic test embedder. Hashes the input text to a small vector of pseudo-random floats. Never use in production — produces meaningless vectors.
Useful for unit tests of storage backends where we just need some vector to round-trip through vector tables.
Implementations§
Source§impl MockEmbedder
impl MockEmbedder
Sourcepub fn new() -> MockEmbedder
pub fn new() -> MockEmbedder
Mock embedder with the default 384 dimension, matching common
local embedding models.
Sourcepub fn with_dim(dim: usize) -> MockEmbedder
pub fn with_dim(dim: usize) -> MockEmbedder
Mock embedder with an arbitrary dim. Use only for tests that override the migration schema.
Trait Implementations§
Source§impl Clone for MockEmbedder
impl Clone for MockEmbedder
Source§fn clone(&self) -> MockEmbedder
fn clone(&self) -> MockEmbedder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MockEmbedder
impl Debug for MockEmbedder
Source§impl Default for MockEmbedder
impl Default for MockEmbedder
Source§fn default() -> MockEmbedder
fn default() -> MockEmbedder
Returns the “default value” for a type. Read more
Source§impl Embedder for MockEmbedder
impl Embedder for MockEmbedder
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
Stable model identifier (e.g.,
"bge-small-en-v1.5").Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbedderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MockEmbedder: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, EmbedderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
MockEmbedder: 'async_trait,
Embed one piece of text.
Source§fn embed_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn embed_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, EmbedderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Embed a batch of texts. Default implementation calls
embed
sequentially; production embedders should override for batching.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