Skip to main content

EmbeddingService

Trait EmbeddingService 

Source
pub trait EmbeddingService:
    Send
    + Sync
    + 'static {
    type EmbedStreamStream: Stream<Item = Result<EmbedResponse, Status>> + Send + 'static;

    // Required methods
    fn embed<'life0, 'async_trait>(
        &'life0 self,
        request: Request<EmbedRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<EmbedResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn health<'life0, 'async_trait>(
        &'life0 self,
        request: Request<HealthRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<HealthResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn model_info<'life0, 'async_trait>(
        &'life0 self,
        request: Request<ModelInfoRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<ModelInfoResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn embed_stream<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Streaming<EmbedRequest>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::EmbedStreamStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with EmbeddingServiceServer.

Required Associated Types§

Source

type EmbedStreamStream: Stream<Item = Result<EmbedResponse, Status>> + Send + 'static

Server streaming response type for the EmbedStream method.

Required Methods§

Source

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

Embed a batch of texts in a single round-trip.

Source

fn health<'life0, 'async_trait>( &'life0 self, request: Request<HealthRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<HealthResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check whether the model is loaded and the service is ready.

Source

fn model_info<'life0, 'async_trait>( &'life0 self, request: Request<ModelInfoRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<ModelInfoResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return metadata about the currently loaded model.

Source

fn embed_stream<'life0, 'async_trait>( &'life0 self, request: Request<Streaming<EmbedRequest>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::EmbedStreamStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Bidirectional streaming embed for large or continuous workloads.

Implementors§