Skip to main content

EmbeddingProviderV1

Trait EmbeddingProviderV1 

Source
pub trait EmbeddingProviderV1:
    Send
    + Sync
    + 'static {
    // Required methods
    fn embedding_space(&self) -> &EmbeddingSpaceId;
    fn dimension(&self) -> u32;
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        req: EmbedRequest,
    ) -> Pin<Box<dyn Future<Output = Result<EmbedResponse, EmbeddingProviderError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn health<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), EmbeddingProviderError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

The embedding-provider plugin contract (cpt-cf-graph-storage-contract-embedding-provider).

Required Methods§

Source

fn embedding_space(&self) -> &EmbeddingSpaceId

Model artifact, tokenizer artifact, preprocessing and pooling configuration — not just a dimension.

Source

fn dimension(&self) -> u32

Source

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

Source

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), EmbeddingProviderError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl EmbeddingProviderV1 for OnnxEmbeddingProvider

Source§

fn embedding_space(&self) -> &EmbeddingSpaceId

Source§

fn dimension(&self) -> u32

Source§

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

Source§

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), EmbeddingProviderError>> + Send + 'async_trait>>
where 'life0: 'async_trait, OnnxEmbeddingProvider: 'async_trait,

Source§

impl EmbeddingProviderV1 for RemoteEmbeddingProvider

Source§

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), EmbeddingProviderError>> + Send + 'async_trait>>
where 'life0: 'async_trait, RemoteEmbeddingProvider: 'async_trait,

One short request. The endpoint has no cheaper probe that every compatible server implements, so readiness costs one embedding.

Source§

fn embedding_space(&self) -> &EmbeddingSpaceId

Source§

fn dimension(&self) -> u32

Source§

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

Implementors§