pub struct SimpleEmbeddingModel { /* private fields */ }Expand description
Simple embedding model based on token frequency statistics.
This is a deterministic, in-memory embedding implementation:
- Maintains a fixed-size vocabulary (
dimensionslots). - Each token is hashed into one of the
dimensionslots using FNV-1a. - The embedding vector is the L2-normalized token-frequency histogram.
This is NOT a neural embedding (no semantic knowledge), but it is a real, deterministic, reproducible vector representation suitable for testing similarity-search pipelines end-to-end.
Implementations§
Trait Implementations§
Source§impl EmbeddingModel for SimpleEmbeddingModel
impl EmbeddingModel for SimpleEmbeddingModel
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>, AiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>, AiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dimension(&self) -> usize
fn model_name(&self) -> &str
Auto Trait Implementations§
impl !Freeze for SimpleEmbeddingModel
impl !RefUnwindSafe for SimpleEmbeddingModel
impl Send for SimpleEmbeddingModel
impl Sync for SimpleEmbeddingModel
impl Unpin for SimpleEmbeddingModel
impl UnsafeUnpin for SimpleEmbeddingModel
impl UnwindSafe for SimpleEmbeddingModel
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