Skip to content

Commit f386eb3

Browse files
author
bcode
committed
fix(provider): prefer per-model temperature over agent override
`ProviderTransform.temperature(model)` encodes per-model-family temperature values that the model's provider requires (e.g. Moonshot's kimi-k2.* returns HTTP 400 "invalid temperature: only 1 is allowed for this model" if any other value is sent). The session/llm.ts call site consulted it in the wrong order: input.agent.temperature ?? ProviderTransform.temperature(input.model) so the built-in title agent's hard-coded `temperature: 0.5` (agent.ts:271) won over the kimi-required 1.0, and Moonshot rejected the request. Swap the operands. The transform value, when present, is the model-aware answer and should beat a generic agent default. For models that aren't in the transform map, the function returns `undefined` and the agent's preference still applies through `??` fallthrough. Affects: kimi-k2.* (incl. k2.6, thinking, k2-5), gemini, glm-4.6/4.7, minimax-m2, qwen — anywhere the transform has an entry.
1 parent de1d917 commit f386eb3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • packages/opencode/src/session

packages/opencode/src/session/llm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const live: Layer.Layer<
169169
},
170170
{
171171
temperature: input.model.capabilities.temperature
172-
? (input.agent.temperature ?? ProviderTransform.temperature(input.model))
172+
? (ProviderTransform.temperature(input.model) ?? input.agent.temperature)
173173
: undefined,
174174
topP: input.agent.topP ?? ProviderTransform.topP(input.model),
175175
topK: ProviderTransform.topK(input.model),

0 commit comments

Comments
 (0)