fix(core): send Grok reasoning effort on Bedrock Converse (#51151)

This commit is contained in:
Aiden Cline
2026-09-24 11:06:05 -05:00
committed by GitHub
Unverified
parent 6afcc887c8
commit 0e4ad0ce76
2 changed files with 19 additions and 1 deletions
+1 -1
View File
@@ -378,7 +378,7 @@ const bedrockConverse: Protocol = (model, support) => {
output_config: { effort },
})
if (id.includes("openai.gpt-oss")) return fields({ reasoning_effort: effort })
if (id.includes("openai.")) return fields({ reasoning: { effort } })
if (id.includes("openai.") || id.includes("xai.")) return fields({ reasoning: { effort } })
return fields({ reasoningConfig: { type: "enabled", maxReasoningEffort: effort } })
})
case "toggle":
+18
View File
@@ -196,6 +196,24 @@ test("spells Chat Completions variants for direct providers", () => {
])
})
test("spells Bedrock Converse effort for Grok and Nova", () => {
const supports: Variant.Support[] = [{ type: "effort", values: ["low", "xhigh"] }]
expect(resolve(model("@opencode/ai/providers/amazon-bedrock", "us.xai.grok-4.6"), supports)).toEqual([
{ id: "low", body: { additionalModelRequestFields: { reasoning: { effort: "low" } } } },
{ id: "xhigh", body: { additionalModelRequestFields: { reasoning: { effort: "xhigh" } } } },
])
expect(resolve(model("@opencode/ai/providers/amazon-bedrock", "us.amazon.nova-2-lite-v1:0"), supports)).toEqual([
{
id: "low",
body: { additionalModelRequestFields: { reasoningConfig: { type: "enabled", maxReasoningEffort: "low" } } },
},
{
id: "xhigh",
body: { additionalModelRequestFields: { reasoningConfig: { type: "enabled", maxReasoningEffort: "xhigh" } } },
},
])
})
test("spells Chat Completions variants for hosting providers", () => {
expect(
resolve(model("@opencode/ai/providers/openai-compatible", "deepseek-ai/deepseek-v4-pro", undefined, "nvidia"), [