pub trait EmbeddingProvider: Send + Sync {
// Required methods
fn embed(&self, text: &str) -> Result<Vec<f32>, EmbeddingError>;
fn embed_batch(
&self,
texts: &[String],
) -> Result<Vec<Vec<f32>>, EmbeddingError>;
fn dimension(&self) -> usize;
}Expand description
Embedding provider trait
Required Methods§
fn embed(&self, text: &str) -> Result<Vec<f32>, EmbeddingError>
fn embed_batch(&self, texts: &[String]) -> Result<Vec<Vec<f32>>, EmbeddingError>
fn dimension(&self) -> usize
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl EmbeddingProvider for MockEmbeddingProvider
impl EmbeddingProvider for PythonEmbeddingProvider
Available on non-WebAssembly only.