pub trait EmbeddingProvider: Send + Sync {
type Config: ProviderConfig;
type Error: ProviderError;
// Required method
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Embedding>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Trait for providers that support text embeddings.
This is a separate capability from chat/completion as not all providers support embeddings, and embedding-only providers don’t need chat capabilities.
Required Associated Types§
Sourcetype Config: ProviderConfig
type Config: ProviderConfig
Provider-specific configuration type
Sourcetype Error: ProviderError
type Error: ProviderError
Provider-specific error type