pub struct SimEmbeddingProvider { /* private fields */ }Expand description
In-memory embedding provider for deterministic simulation testing.
Features:
- Deterministic: same text + same seed = same embedding
- No external dependencies
- Fast (no network calls)
- Normalized embeddings (unit vectors)
- Fault injection support for DST
Implementations§
Source§impl SimEmbeddingProvider
impl SimEmbeddingProvider
Sourcepub fn with_faults(seed: u64, fault_injector: Arc<FaultInjector>) -> Self
pub fn with_faults(seed: u64, fault_injector: Arc<FaultInjector>) -> Self
Create with fault injection enabled.
Trait Implementations§
Source§impl Clone for SimEmbeddingProvider
impl Clone for SimEmbeddingProvider
Source§fn clone(&self) -> SimEmbeddingProvider
fn clone(&self) -> SimEmbeddingProvider
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl EmbeddingProvider for SimEmbeddingProvider
impl EmbeddingProvider for SimEmbeddingProvider
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,
Generate embedding for a single text. Read more
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,
Generate embeddings for multiple texts (batch). Read more
Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Get the embedding dimensions (e.g., 1536 for text-embedding-3-small).
Source§fn is_simulation(&self) -> bool
fn is_simulation(&self) -> bool
Check if this is a simulation provider. Read more
Auto Trait Implementations§
impl Freeze for SimEmbeddingProvider
impl RefUnwindSafe for SimEmbeddingProvider
impl Send for SimEmbeddingProvider
impl Sync for SimEmbeddingProvider
impl Unpin for SimEmbeddingProvider
impl UnwindSafe for SimEmbeddingProvider
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