Skip to main content

LanguageModel

Trait LanguageModel 

Source
pub trait LanguageModel {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn complete(&self, prompt: &str) -> Result<String>;
    fn complete_with_params(
        &self,
        prompt: &str,
        params: GenerationParams,
    ) -> Result<String>;
    fn is_available(&self) -> bool;
    fn model_info(&self) -> ModelInfo;
}
Expand description

Large Language Model abstraction for text generation

§Synchronous Version

This trait provides synchronous operations for text generation.

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned by generation operations

Required Methods§

Source

fn complete(&self, prompt: &str) -> Result<String>

Generate text completion

Source

fn complete_with_params( &self, prompt: &str, params: GenerationParams, ) -> Result<String>

Generate text with custom parameters

Source

fn is_available(&self) -> bool

Check if the model is available

Source

fn model_info(&self) -> ModelInfo

Get model information

Implementors§