pub trait EmbeddingProvider {
// Required methods
fn embed_batch(
&self,
texts: &[String],
) -> Result<Vec<Vec<f32>>, EmbeddingError>;
fn dim(&self) -> usize;
// Provided method
fn embed(&self, text: &str) -> Result<Vec<f32>, EmbeddingError> { ... }
}Expand description
Trait for embedding providers.
Implementations can use local models (ONNX, sentence-transformers), remote APIs (Ollama, OpenAI), or deterministic hashing (for testing).
Required Methods§
Sourcefn embed_batch(&self, texts: &[String]) -> Result<Vec<Vec<f32>>, EmbeddingError>
fn embed_batch(&self, texts: &[String]) -> Result<Vec<Vec<f32>>, EmbeddingError>
Embed a batch of text strings into vectors.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".