diff --git a/crates/goose/src/model.rs b/crates/goose/src/model.rs index 480891fbf2..68f7f304d1 100644 --- a/crates/goose/src/model.rs +++ b/crates/goose/src/model.rs @@ -111,6 +111,12 @@ impl ModelConfig { } pub fn with_canonical_limits(mut self, provider_name: &str) -> Self { + if let Some(pm) = find_predefined_model(&self.model_name) { + if self.context_limit.is_none() { + self.context_limit = pm.context_limit; + } + } + if let Some(canonical) = crate::providers::canonical::maybe_get_canonical_model(provider_name, &self.model_name) { @@ -125,13 +131,6 @@ impl ModelConfig { } } - // Try filling remaining gaps from predefined models - if self.context_limit.is_none() { - if let Some(pm) = find_predefined_model(&self.model_name) { - self.context_limit = pm.context_limit; - } - } - self }