use core::future::Future;
use alloc::{string::String, vec::Vec};
use crate::{LanguageModel, llm::model};
pub trait LanguageModelProvider {
type Model: LanguageModel;
type Error: core::error::Error;
fn list_models(&self) -> impl Future<Output = Result<Vec<model::Profile>, Self::Error>> + Send;
fn get_model(
&self,
name: &str,
) -> impl Future<Output = Result<Self::Model, Self::Error>> + Send;
fn profile() -> Profile;
}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Profile {
name: String,
description: String,
}
impl Profile {
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self {
Self {
name: name.into(),
description: description.into(),
}
}
#[must_use]
pub const fn name(&self) -> &str {
self.name.as_str()
}
#[must_use]
pub const fn description(&self) -> &str {
self.description.as_str()
}
}