Skip to main content

EmbeddingProvider

Trait EmbeddingProvider 

Source
pub trait EmbeddingProvider: Send + Sync {
    // Required methods
    fn provider_id(&self) -> &str;
    fn model_id(&self) -> &str;
    fn model_version(&self) -> &str;
    fn dimension(&self) -> u32;
    fn normalization(&self) -> EmbeddingNormalization;
    fn preprocessing_version(&self) -> &str;
    fn embed(
        &self,
        request: EmbeddingRequest<'_>,
    ) -> Result<EmbeddingResponse, EmbeddingError>;

    // Provided methods
    fn execution_mode(&self) -> ProviderExecutionMode { ... }
    fn health(&self) -> ProviderHealth { ... }
    fn embed_async<'a>(
        &'a self,
        request: EmbeddingRequest<'a>,
    ) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, EmbeddingError>> + Send + 'a>> { ... }
}

Required Methods§

Source

fn provider_id(&self) -> &str

Source

fn model_id(&self) -> &str

Source

fn model_version(&self) -> &str

Source

fn dimension(&self) -> u32

Source

fn normalization(&self) -> EmbeddingNormalization

Source

fn preprocessing_version(&self) -> &str

Source

fn embed( &self, request: EmbeddingRequest<'_>, ) -> Result<EmbeddingResponse, EmbeddingError>

Controlled synchronous inference used by transactional generated columns. Implementations must checkpoint during long work.

Provided Methods§

Source

fn execution_mode(&self) -> ProviderExecutionMode

Source

fn health(&self) -> ProviderHealth

Source

fn embed_async<'a>( &'a self, request: EmbeddingRequest<'a>, ) -> Pin<Box<dyn Future<Output = Result<EmbeddingResponse, EmbeddingError>> + Send + 'a>>

Async transport hook for remote providers. The default is suitable only for short cooperative local inference; heavy local implementations must override this and use a bounded blocking executor.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§