@@ -73,10 +73,7 @@ impl ModelConfig {
7373 Ok ( config. with_canonical_limits ( provider_name) )
7474 }
7575
76- /// Internal base constructor: parses env vars and predefined request_params.
77- /// Does NOT do canonical lookup (that requires a provider).
7876 fn new_base ( model_name : String , context_env_var : Option < & str > ) -> Result < Self , ConfigError > {
79- // Priority 1: Check env vars first (highest priority)
8077 let context_limit = if let Some ( env_var) = context_env_var {
8178 if let Ok ( val) = std:: env:: var ( env_var) {
8279 Some ( Self :: validate_context_limit ( & val, env_var) ?)
@@ -110,10 +107,7 @@ impl ModelConfig {
110107 } )
111108 }
112109
113- /// Apply canonical model limits from the registry, then predefined model defaults.
114- /// Priority: env vars (already set) > canonical > predefined.
115110 pub fn with_canonical_limits ( mut self , provider_name : & str ) -> Self {
116- // Priority 2: Try canonical model lookup (fills gaps left by env vars)
117111 if self . context_limit . is_none ( ) || self . max_tokens . is_none ( ) {
118112 if let Some ( canonical) = crate :: providers:: canonical:: maybe_get_canonical_model (
119113 provider_name,
@@ -128,7 +122,7 @@ impl ModelConfig {
128122 }
129123 }
130124
131- // Priority 3: Check predefined models (fills remaining gaps)
125+ // Try filling remaining gaps from predefined models
132126 if self . context_limit . is_none ( ) {
133127 if let Some ( pm) = find_predefined_model ( & self . model_name ) {
134128 self . context_limit = pm. context_limit ;
0 commit comments