Skip to main content

vtcode_config/core/agent/
small_model.rs

1//! Small/lightweight model tier configuration.
2
3use serde::{Deserialize, Serialize};
4
5/// Small/lightweight model configuration for efficient operations
6///
7/// Following VT Code's pattern, use a smaller model (e.g., Haiku, GPT-4 Mini) for 50%+ of calls:
8/// - Large file reads and parsing (>50KB)
9/// - Web page summarization and analysis
10/// - Git history and commit message processing
11/// - One-word processing labels and simple classifications
12///
13/// Typically 70-80% cheaper than the main model while maintaining quality for these tasks.
14#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
15#[derive(Debug, Clone, Deserialize, Serialize)]
16pub struct AgentSmallModelConfig {
17    /// Enable small model tier for efficient operations
18    #[serde(default = "default_small_model_enabled")]
19    pub enabled: bool,
20
21    /// Small model to use (e.g., claude-4-5-haiku, "gpt-4-mini", "gemini-2.0-flash")
22    /// Leave empty to auto-select a lightweight sibling of the main model
23    #[serde(default)]
24    pub model: String,
25
26    /// Temperature for small model responses
27    #[serde(default = "default_small_model_temperature")]
28    pub temperature: f32,
29
30    /// Enable small model for large file reads (>50KB)
31    #[serde(default = "default_small_model_for_large_reads")]
32    pub use_for_large_reads: bool,
33
34    /// Enable small model for web content summarization
35    #[serde(default = "default_small_model_for_web_summary")]
36    pub use_for_web_summary: bool,
37
38    /// Enable small model for git history processing
39    #[serde(default = "default_small_model_for_git_history")]
40    pub use_for_git_history: bool,
41
42    /// Enable small model for persistent memory classification and summary refresh
43    #[serde(default = "default_small_model_for_memory")]
44    pub use_for_memory: bool,
45}
46
47impl Default for AgentSmallModelConfig {
48    fn default() -> Self {
49        Self {
50            enabled: default_small_model_enabled(),
51            model: String::new(),
52            temperature: default_small_model_temperature(),
53            use_for_large_reads: default_small_model_for_large_reads(),
54            use_for_web_summary: default_small_model_for_web_summary(),
55            use_for_git_history: default_small_model_for_git_history(),
56            use_for_memory: default_small_model_for_memory(),
57        }
58    }
59}
60
61#[inline]
62const fn default_small_model_enabled() -> bool {
63    true // Enable by default following VT Code pattern
64}
65
66#[inline]
67const fn default_small_model_temperature() -> f32 {
68    0.3 // More deterministic for parsing/summarization
69}
70
71#[inline]
72const fn default_small_model_for_large_reads() -> bool {
73    true
74}
75
76#[inline]
77const fn default_small_model_for_web_summary() -> bool {
78    true
79}
80
81#[inline]
82const fn default_small_model_for_git_history() -> bool {
83    true
84}
85
86#[inline]
87const fn default_small_model_for_memory() -> bool {
88    true
89}