Omit reasoning params for non-reasoning models (#2932)

This commit is contained in:
Chris Estreich 2025-04-25 15:24:03 -07:00 committed by GitHub
parent cb29e9d56f
commit c8b5cdf7b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"roo-cline": patch
---
Omit reasoning params for non-reasoning models

View file

@ -9,6 +9,7 @@ import {
openRouterDefaultModelInfo,
PROMPT_CACHING_MODELS,
OPTIONAL_PROMPT_CACHING_MODELS,
REASONING_MODELS,
} from "../../shared/api"
import { convertToOpenAiMessages } from "../transform/openai-format"
import { ApiStreamChunk } from "../transform/stream"
@ -147,7 +148,7 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
}),
// This way, the transforms field will only be included in the parameters when openRouterUseMiddleOutTransform is true.
...((this.options.openRouterUseMiddleOutTransform ?? true) && { transforms: ["middle-out"] }),
...(reasoningEffort && { reasoning: { effort: reasoningEffort } }),
...(REASONING_MODELS.has(modelId) && reasoningEffort && { reasoning: { effort: reasoningEffort } }),
}
const stream = await this.client.chat.completions.create(completionParams)