Auto-detect context window size from GGUF for embedded providers

- Add context_window_size() method to LLMProvider trait
- Implement for EmbeddedProvider to return the auto-detected context length
- Update Agent to query provider directly instead of using hardcoded defaults
- Removes need for model-specific context length mappings
This commit is contained in:
Dhanji R. Prasanna
2026-01-28 11:16:14 +11:00
parent 55dba121b7
commit 58fe74334d
3 changed files with 19 additions and 14 deletions

View File

@@ -700,6 +700,10 @@ impl LLMProvider for EmbeddedProvider {
fn temperature(&self) -> f32 {
self.temperature
}
fn context_window_size(&self) -> Option<u32> {
Some(self.context_length)
}
}
#[cfg(test)]

View File

@@ -39,6 +39,12 @@ pub trait LLMProvider: Send + Sync {
/// Get the configured temperature for this provider
fn temperature(&self) -> f32;
/// Get the context window size for this provider
/// Returns None if the provider doesn't have a fixed context window
fn context_window_size(&self) -> Option<u32> {
None
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]