Trait Backend

Source
pub trait Backend: Send + Sync {
    // Required methods
    fn generate<'life0, 'async_trait>(
        &'life0 self,
        request: BackendGenerationRequest,
    ) -> Pin<Box<dyn Future<Output = Result<BackendGenerationResponse, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn generate_stream<'life0, 'async_trait>(
        &'life0 self,
        request: BackendGenerationRequest,
    ) -> Pin<Box<dyn Future<Output = Result<NotificationStream<BackendGenerationResponse>, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The backend service which the core uses to generate text. Implements a low-level interface for interacting with language models.

Required Methods§

Source

fn generate<'life0, 'async_trait>( &'life0 self, request: BackendGenerationRequest, ) -> Pin<Box<dyn Future<Output = Result<BackendGenerationResponse, ProtocolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Generate text and return the whole response.

Source

fn generate_stream<'life0, 'async_trait>( &'life0 self, request: BackendGenerationRequest, ) -> Pin<Box<dyn Future<Output = Result<NotificationStream<BackendGenerationResponse>, ProtocolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Request text generation and return an asynchronous stream of generated tokens.

Implementors§