Skip to content

Commit 82ab888

Browse files
committed
fix(ollama): respect explicit reasoning flag for think gating
Codex P2: isReasoningModelHeuristic alone misses models with explicit reasoning:true config. Also check ctx.model.reasoning. Refs: #67958
1 parent 8347dc0 commit 82ab888

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

extensions/ollama/src/stream.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ export function createConfiguredOllamaCompatStreamWrapper(
205205
// Only apply the think parameter for models that are known to support thinking.
206206
// Models like qwen2.5:0.5b don't support the think parameter at all and will
207207
// return a 400 error if the parameter is sent (even with think=false).
208-
const supportsThinking = isReasoningModelHeuristic(ctx.modelId);
208+
// Check both the heuristic (model ID patterns) AND explicit model config reasoning flag.
209+
const supportsThinking = isReasoningModelHeuristic(ctx.modelId) || ctx.model?.reasoning === true;
209210

210211
if (supportsThinking && ctx.thinkingLevel === "off") {
211212
streamFn = createOllamaThinkingWrapper(streamFn, false);

0 commit comments

Comments
 (0)