Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: RequestResponse<EmbedRequest, EmbedResponse> {
    // Required methods
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        req: EmbedRequest,
    ) -> Pin<Box<dyn Future<Output = AppResult<EmbedResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn embed_batch<'life0, 'async_trait>(
        &'life0 self,
        reqs: Vec<EmbedRequest>,
    ) -> Pin<Box<dyn Future<Output = AppResult<Vec<EmbedResponse>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for canonical multimodal embedding providers.

Extends rskit_provider::RequestResponse<EmbedRequest, EmbedResponse> so any embedding provider can be plugged directly into pipeline / dag / worker flows.

Required Methods§

Source

fn embed<'life0, 'async_trait>( &'life0 self, req: EmbedRequest, ) -> Pin<Box<dyn Future<Output = AppResult<EmbedResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate embeddings for one request.

Source

fn embed_batch<'life0, 'async_trait>( &'life0 self, reqs: Vec<EmbedRequest>, ) -> Pin<Box<dyn Future<Output = AppResult<Vec<EmbedResponse>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate embeddings for a caller-controlled batch of requests.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§