Skip to main content

LlmEngine

Trait LlmEngine 

Source
pub trait LlmEngine: Send + Sync {
    // Required methods
    fn infer<'life0, 'async_trait>(
        &'life0 mut self,
        model: InferencingModel,
        prompt: String,
        params: InferencingParams,
        max_result_bytes: usize,
    ) -> Pin<Box<dyn Future<Output = Result<InferencingResult, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn generate_embeddings<'life0, 'async_trait>(
        &'life0 mut self,
        model: EmbeddingModel,
        data: Vec<String>,
        max_result_bytes: usize,
    ) -> Pin<Box<dyn Future<Output = Result<EmbeddingsResult, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn summary(&self) -> Option<String> { ... }
}
Expand description

The interface for a language model engine.

Required Methods§

Source

fn infer<'life0, 'async_trait>( &'life0 mut self, model: InferencingModel, prompt: String, params: InferencingParams, max_result_bytes: usize, ) -> Pin<Box<dyn Future<Output = Result<InferencingResult, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn generate_embeddings<'life0, 'async_trait>( &'life0 mut self, model: EmbeddingModel, data: Vec<String>, max_result_bytes: usize, ) -> Pin<Box<dyn Future<Output = Result<EmbeddingsResult, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn summary(&self) -> Option<String>

A human-readable summary of the given engine’s configuration

Example: “local model”

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl LlmEngine for RemoteHttpLlmEngine

Source§

fn infer<'life0, 'async_trait>( &'life0 mut self, model: InferencingModel, prompt: String, params: InferencingParams, max_result_bytes: usize, ) -> Pin<Box<dyn Future<Output = Result<InferencingResult, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn generate_embeddings<'life0, 'async_trait>( &'life0 mut self, model: EmbeddingModel, data: Vec<String>, max_result_bytes: usize, ) -> Pin<Box<dyn Future<Output = Result<EmbeddingsResult, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn summary(&self) -> Option<String>

Implementors§