mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: ensure OpenAI reasoning effort supports minimal value
- Remove special case that filtered out "minimal" reasoning effort for OpenAI - OpenAI models (including GPT-5) support all effort levels including "minimal" - Add comprehensive tests for all reasoning effort values including "minimal" - Align OpenAI behavior with OpenRouter which correctly passes through "minimal"
This commit is contained in:
parent
6b159c946c
commit
d57bb824b6
2 changed files with 38 additions and 9 deletions
|
|
@ -530,21 +530,54 @@ describe("reasoning.ts", () => {
|
|||
expect(result).toEqual({ reasoning_effort: undefined })
|
||||
})
|
||||
|
||||
it("should handle all reasoning effort values", () => {
|
||||
const efforts: Array<"low" | "medium" | "high"> = ["low", "medium", "high"]
|
||||
it("should handle all reasoning effort values including minimal", () => {
|
||||
const efforts: Array<ReasoningEffortWithMinimal> = ["minimal", "low", "medium", "high"]
|
||||
|
||||
efforts.forEach((effort) => {
|
||||
const modelWithEffort: ModelInfo = {
|
||||
...baseModel,
|
||||
supportsReasoningEffort: true,
|
||||
}
|
||||
|
||||
const settingsWithEffort: ProviderSettings = {
|
||||
reasoningEffort: effort,
|
||||
}
|
||||
|
||||
const options = { ...baseOptions, model: modelWithEffort, reasoningEffort: effort }
|
||||
const options = {
|
||||
...baseOptions,
|
||||
model: modelWithEffort,
|
||||
settings: settingsWithEffort,
|
||||
reasoningEffort: effort,
|
||||
}
|
||||
const result = getOpenAiReasoning(options)
|
||||
// All effort values including "minimal" should be passed through for OpenAI (e.g., GPT-5)
|
||||
expect(result).toEqual({ reasoning_effort: effort })
|
||||
})
|
||||
})
|
||||
|
||||
it("should handle minimal reasoning effort specifically", () => {
|
||||
const modelWithEffort: ModelInfo = {
|
||||
...baseModel,
|
||||
supportsReasoningEffort: true,
|
||||
}
|
||||
|
||||
const settingsWithMinimal: ProviderSettings = {
|
||||
reasoningEffort: "minimal",
|
||||
}
|
||||
|
||||
const options = {
|
||||
...baseOptions,
|
||||
model: modelWithEffort,
|
||||
settings: settingsWithMinimal,
|
||||
reasoningEffort: "minimal" as ReasoningEffortWithMinimal,
|
||||
}
|
||||
|
||||
const result = getOpenAiReasoning(options)
|
||||
|
||||
// "minimal" should be passed through for OpenAI models like GPT-5
|
||||
expect(result).toEqual({ reasoning_effort: "minimal" })
|
||||
})
|
||||
|
||||
it("should not be affected by reasoningBudget parameter", () => {
|
||||
const modelWithEffort: ModelInfo = {
|
||||
...baseModel,
|
||||
|
|
|
|||
|
|
@ -62,12 +62,8 @@ export const getOpenAiReasoning = ({
|
|||
return undefined
|
||||
}
|
||||
|
||||
// If model has reasoning effort capability, return object even if effort is undefined
|
||||
// This preserves the reasoning_effort field in the API call
|
||||
if (reasoningEffort === "minimal") {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// If model has reasoning effort capability, return object with the effort
|
||||
// OpenAI models (including GPT-5) support all effort levels including "minimal"
|
||||
return { reasoning_effort: reasoningEffort }
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue