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:
@@ -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)]
|
||||
|
||||
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user