Skip to main content

vtcode_config/models/model_id/
description.rs

1use std::borrow::Cow;
2
3use super::ModelId;
4
5impl ModelId {
6    /// Get a description of the model's characteristics.
7    ///
8    /// Returns `Cow<'static, str>` because custom user-defined models
9    /// carry runtime strings that may not be `'static`.
10    pub fn description(&self) -> Cow<'static, str> {
11        if let Some(meta) = self.openrouter_metadata() {
12            return Cow::Borrowed(meta.description);
13        }
14        if let Some(description) = self.table_description() {
15            return Cow::Borrowed(description);
16        }
17        match self {
18            // OpenRouter models without generated metadata
19            ModelId::OpenRouterMoonshotaiKimiK3 => Cow::Borrowed(
20                "Kimi K3 2.8T parameter flagship with 1M context, native vision, and always-on deep reasoning via OpenRouter",
21            ),
22            // Custom user-defined models
23            ModelId::Custom(_, _) => Cow::Borrowed("User-defined model"),
24            model => Cow::Borrowed(
25                model
26                    .openrouter_metadata()
27                    .expect("generated OpenRouter model should have metadata")
28                    .description,
29            ),
30        }
31    }
32}