Skip to main content

EmbeddingProvider

Trait EmbeddingProvider 

Source
pub trait EmbeddingProvider: Send + Sync {
    // Required methods
    fn descriptor(&self) -> EmbeddingProviderDescriptor;
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        request: EmbeddingBatchRequest,
        cancellation: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<EmbeddingBatchResponse, EmbeddingProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Host-owned source of embedding vectors.

Implementations receive only inputs already admitted by the caller. They must honor cancellation and return one vector for each input identifier.

Required Methods§

Source

fn descriptor(&self) -> EmbeddingProviderDescriptor

Descriptor captured when a Code embedding generation is constructed.

Source

fn embed<'life0, 'async_trait>( &'life0 self, request: EmbeddingBatchRequest, cancellation: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<EmbeddingBatchResponse, EmbeddingProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Embed one executor-bounded batch.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§