spin_factor_llm

Trait LlmEngine

Source
pub trait LlmEngine: Send + Sync {
    // Required methods
    fn infer<'life0, 'async_trait>(
        &'life0 mut self,
        model: InferencingModel,
        prompt: String,
        params: InferencingParams,
    ) -> 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>,
    ) -> 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, ) -> 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>, ) -> 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”

Implementations on Foreign Types§

Source§

impl LlmEngine for RemoteHttpLlmEngine

Source§

fn infer<'life0, 'async_trait>( &'life0 mut self, model: InferencingModel, prompt: String, params: InferencingParams, ) -> 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>, ) -> 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§