MCPcopy Create free account
hub / github.com/AI45Lab/Code / apply_model_caps

Function apply_model_caps

core/src/config/provider.rs:131–155  ·  view source on GitHub ↗

Apply model capability flags to an LlmConfig. - `temperature = false` → omit temperature (model ignores it, e.g. o1) - `reasoning = true` + `thinking_budget` set → pass budget to client - `limit.output > 0` → use as max_tokens

(
    mut config: LlmConfig,
    model: &ModelConfig,
    thinking_budget: Option<usize>,
)

Source from the content-addressed store, hash-verified

129/// - `reasoning = true` + `thinking_budget` set → pass budget to client
130/// - `limit.output > 0` → use as max_tokens
131pub(crate) fn apply_model_caps(
132 mut config: LlmConfig,
133 model: &ModelConfig,
134 thinking_budget: Option<usize>,
135) -> LlmConfig {
136 // reasoning=true + thinking_budget set → pass budget to client (Anthropic only)
137 if model.reasoning {
138 if let Some(budget) = thinking_budget {
139 config = config.with_thinking_budget(budget);
140 }
141 }
142
143 // limit.output > 0 → use as max_tokens cap
144 if model.limit.output > 0 {
145 config = config.with_max_tokens(model.limit.output as usize);
146 }
147
148 // temperature=false models (e.g. o1) must not receive a temperature param.
149 // Store the flag so the LLM client can gate it at call time.
150 if !model.temperature {
151 config.disable_temperature = true;
152 }
153
154 config
155}
156
157impl ProviderConfig {
158 /// Find a model by ID

Callers 2

default_llm_configMethod · 0.85
llm_configMethod · 0.85

Calls 2

with_thinking_budgetMethod · 0.45
with_max_tokensMethod · 0.45

Tested by

no test coverage detected