Selaa lähdekoodia

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

Chris Estreich 8 kuukautta sitten
vanhempi
sitoutus
c8b5cdf7b2
2 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  1. 5 0
      .changeset/khaki-months-float.md
  2. 2 1
      src/api/providers/openrouter.ts

+ 5 - 0
.changeset/khaki-months-float.md

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

+ 2 - 1
src/api/providers/openrouter.ts

@@ -9,6 +9,7 @@ import {
 	openRouterDefaultModelInfo,
 	openRouterDefaultModelInfo,
 	PROMPT_CACHING_MODELS,
 	PROMPT_CACHING_MODELS,
 	OPTIONAL_PROMPT_CACHING_MODELS,
 	OPTIONAL_PROMPT_CACHING_MODELS,
+	REASONING_MODELS,
 } from "../../shared/api"
 } from "../../shared/api"
 import { convertToOpenAiMessages } from "../transform/openai-format"
 import { convertToOpenAiMessages } from "../transform/openai-format"
 import { ApiStreamChunk } from "../transform/stream"
 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 way, the transforms field will only be included in the parameters when openRouterUseMiddleOutTransform is true.
 			...((this.options.openRouterUseMiddleOutTransform ?? true) && { transforms: ["middle-out"] }),
 			...((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)
 		const stream = await this.client.chat.completions.create(completionParams)