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§
Sourcefn 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<'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.
Sourcefn 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 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.
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn init_project(&self) -> Result<(), ProtocolError>
fn init_project(&self) -> Result<(), ProtocolError>
Initialize a new llmvm project in the current directory.