aither_core/llm/
provider.rs1use core::future::Future;
2
3use alloc::{string::String, vec::Vec};
4
5use crate::{LanguageModel, llm::model};
6
7pub trait LanguageModelProvider {
9 type Model: LanguageModel;
11 type Error: core::error::Error;
13
14 fn list_models(&self) -> impl Future<Output = Result<Vec<model::Profile>, Self::Error>> + Send;
16
17 fn get_model(
19 &self,
20 name: &str,
21 ) -> impl Future<Output = Result<Self::Model, Self::Error>> + Send;
22
23 fn profile() -> Profile;
25}
26
27#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
29#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
30pub struct Profile {
31 name: String,
32 description: String,
33}
34
35impl Profile {
36 pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self {
38 Self {
39 name: name.into(),
40 description: description.into(),
41 }
42 }
43
44 #[must_use]
46 pub const fn name(&self) -> &str {
47 self.name.as_str()
48 }
49
50 #[must_use]
52 pub const fn description(&self) -> &str {
53 self.description.as_str()
54 }
55}