summaryrefslogtreecommitdiffstats
path: root/src/config/model_info.rs
blob: 1f8d6f075b8f9fa01abe4e690f8da9375862f52b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#[derive(Debug, Clone)]
pub struct ModelInfo {
    pub client: String,
    pub name: String,
    pub max_tokens: Option<usize>,
    pub index: usize,
}

impl Default for ModelInfo {
    fn default() -> Self {
        ModelInfo::new("", "", None, 0)
    }
}

impl ModelInfo {
    pub fn new(client: &str, name: &str, max_tokens: Option<usize>, index: usize) -> Self {
        Self {
            client: client.into(),
            name: name.into(),
            max_tokens,
            index,
        }
    }
    pub fn stringify(&self) -> String {
        format!("{}:{}", self.client, self.name)
    }
}