Use Canonical Models to set context window sizes (#6723)

This commit is contained in:
David Katz
2026-02-17 11:43:10 -05:00
committed by GitHub
parent 576590d4c8
commit 3959805198
54 changed files with 465 additions and 581 deletions
+1
View File
@@ -1629,6 +1629,7 @@ impl Agent {
.ok_or_else(|| anyhow!("Could not configure agent: missing model"))?;
crate::model::ModelConfig::new(&model_name)
.map_err(|e| anyhow!("Could not configure agent: invalid model {}", e))?
.with_canonical_limits(&provider_name)
}
};
@@ -1417,11 +1417,10 @@ impl SummonClient {
.or_else(|| session.provider_name.clone())
.ok_or_else(|| anyhow::anyhow!("No provider configured"))?;
let mut model_config = session
.model_config
.clone()
.map(Ok)
.unwrap_or_else(|| crate::model::ModelConfig::new("default"))?;
let mut model_config = session.model_config.clone().map(Ok).unwrap_or_else(|| {
crate::model::ModelConfig::new("default")
.map(|c| c.with_canonical_limits(&provider_name))
})?;
if let Some(model) = &params.model {
model_config.model_name = model.clone();