Skip to content

Commit 4449b51

Browse files
Let's reason together (RooCodeInc#1597)
* let's reason together * typo * changeset * Fix type error --------- Co-authored-by: Saoud Rizwan <[email protected]>
1 parent 84f017c commit 4449b51

File tree

7 files changed

+31
-7
lines changed

7 files changed

+31
-7
lines changed

.changeset/little-pianos-juggle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": minor
3+
---
4+
5+
Adding reasoning_effort support for openrouter and openai-native

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@
161161
"type": "boolean",
162162
"default": true,
163163
"description": "Enables extension to save checkpoints of workspace throughout the task."
164+
},
165+
"cline.modelSettings.o3Mini.reasoningEffort": {
166+
"type": "string",
167+
"enum": [
168+
"low",
169+
"medium",
170+
"high"
171+
],
172+
"default": "medium",
173+
"description": "Controls the reasoning effort when using the o3-mini model. Higher values may result in more thorough but slower responses."
164174
}
165175
}
166176
}
@@ -239,7 +249,7 @@
239249
"isbinaryfile": "^5.0.2",
240250
"mammoth": "^1.8.0",
241251
"monaco-vscode-textmate-theme-converter": "^0.1.7",
242-
"openai": "^4.82.0",
252+
"openai": "^4.83.0",
243253
"os-name": "^6.0.0",
244254
"p-wait-for": "^5.0.2",
245255
"pdf-parse": "^1.1.1",

src/api/providers/openai-native.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
} from "../../shared/api"
1212
import { convertToOpenAiMessages } from "../transform/openai-format"
1313
import { ApiStream } from "../transform/stream"
14+
import { ChatCompletionReasoningEffort } from "openai/resources/chat/completions.mjs"
1415

1516
export class OpenAiNativeHandler implements ApiHandler {
1617
private options: ApiHandlerOptions
@@ -51,6 +52,7 @@ export class OpenAiNativeHandler implements ApiHandler {
5152
messages: [{ role: "developer", content: systemPrompt }, ...convertToOpenAiMessages(messages)],
5253
stream: true,
5354
stream_options: { include_usage: true },
55+
reasoning_effort: (this.options.o3MiniReasoningEffort as ChatCompletionReasoningEffort) || "medium",
5456
})
5557
for await (const chunk of stream) {
5658
const delta = chunk.choices[0]?.delta

src/api/providers/openrouter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ export class OpenRouterHandler implements ApiHandler {
130130
stream: true,
131131
transforms: shouldApplyMiddleOutTransform ? ["middle-out"] : undefined,
132132
include_reasoning: true,
133+
...(model.id === "openai/o3-mini" ? { reasoning_effort: this.options.o3MiniReasoningEffort || "medium" } : {}),
133134
})
134135

135136
let genId: string | undefined

src/core/webview/ClineProvider.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,10 @@ export class ClineProvider implements vscode.WebviewViewProvider {
14801480
}
14811481
}
14821482

1483+
const o3MiniReasoningEffort = vscode.workspace
1484+
.getConfiguration("cline.modelSettings.o3Mini")
1485+
.get("reasoningEffort", "medium")
1486+
14831487
return {
14841488
apiConfiguration: {
14851489
apiProvider,
@@ -1517,6 +1521,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
15171521
openRouterModelId,
15181522
openRouterModelInfo,
15191523
vsCodeLmModelSelector,
1524+
o3MiniReasoningEffort,
15201525
liteLlmBaseUrl,
15211526
liteLlmModelId,
15221527
},

src/shared/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface ApiHandlerOptions {
5252
mistralApiKey?: string
5353
azureApiVersion?: string
5454
vsCodeLmModelSelector?: any
55+
o3MiniReasoningEffort?: string
5556
qwenApiLine?: string
5657
}
5758

0 commit comments

Comments
 (0)