Skip to main content

LanguageModelProvider

Trait LanguageModelProvider 

Source
pub trait LanguageModelProvider {
    type Model: LanguageModel;
    type Error: Error;

    // Required methods
    fn list_models(
        &self,
    ) -> impl Future<Output = Result<Vec<Profile>, Self::Error>> + Send;
    fn get_model(
        &self,
        name: &str,
    ) -> impl Future<Output = Result<Self::Model, Self::Error>> + Send;
    fn profile() -> Profile;
}
Expand description

Trait for AI service providers that can list and provide language models.

Required Associated Types§

Source

type Model: LanguageModel

The type of language model this provider creates.

Source

type Error: Error

The error type returned by this provider.

Required Methods§

Source

fn list_models( &self, ) -> impl Future<Output = Result<Vec<Profile>, Self::Error>> + Send

Lists all available models from this provider.

Source

fn get_model( &self, name: &str, ) -> impl Future<Output = Result<Self::Model, Self::Error>> + Send

Gets a specific model by name from this provider.

Source

fn profile() -> Profile

Returns the provider’s profile information.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl LanguageModelProvider for OpenAIProvider

Implementors§