Trait Core

Source
pub trait Core: Send + Sync {
    // Required methods
    fn generate<'life0, 'async_trait>(
        &'life0 self,
        request: GenerationRequest,
    ) -> Pin<Box<dyn Future<Output = Result<GenerationResponse, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn generate_stream<'life0, 'async_trait>(
        &'life0 self,
        request: GenerationRequest,
    ) -> Pin<Box<dyn Future<Output = Result<NotificationStream<GenerationResponse>, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_last_thread_info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ThreadInfo>, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_all_thread_infos<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ThreadInfo>, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_thread_messages<'life0, 'async_trait>(
        &'life0 self,
        id: String,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, ProtocolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn init_project(&self) -> Result<(), ProtocolError>;
}
Expand description

The core service which frontends use to interact with language models. Manages & uses threads, presets, prompt templates and backend connections to create & send backend requests.

Required Methods§

Source

fn generate<'life0, 'async_trait>( &'life0 self, request: GenerationRequest, ) -> Pin<Box<dyn Future<Output = Result<GenerationResponse, 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: GenerationRequest, ) -> Pin<Box<dyn Future<Output = Result<NotificationStream<GenerationResponse>, ProtocolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

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

Source

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

Retrieve information for the last modified thread in the current project or user data directory.

Source

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

Retrieve information for all available threads.

Source

fn get_thread_messages<'life0, 'async_trait>( &'life0 self, id: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<Message>, ProtocolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve all thread messages for a thread id.

Source

fn init_project(&self) -> Result<(), ProtocolError>

Initialize a new llmvm project in the current directory.

Implementors§