From 95503c177347a1a5e011bd0ed1c8fe830d7309b5 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Wed, 9 Sep 2026 12:02:31 -0500 Subject: [PATCH] fix(core): send reasoning.effort for GPT-5.6+ on Bedrock Converse (#48195) --- packages/core/src/aisdk-native.ts | 9 ++++++++- packages/core/test/aisdk-native.test.ts | 23 ++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/core/src/aisdk-native.ts b/packages/core/src/aisdk-native.ts index 72b8d383e3d..49a398256f4 100644 --- a/packages/core/src/aisdk-native.ts +++ b/packages/core/src/aisdk-native.ts @@ -210,6 +210,10 @@ function mapBedrockRequest(input: MapInput): Pick { const reasoning = isRecord(settings.reasoningConfig) ? settings.reasoningConfig : undefined const anthropic = input.modelID.includes("anthropic") const openai = input.modelID.includes("openai.") + // Converse passes OpenAI fields through verbatim. gpt-oss (Harmony) takes the + // flat chat-completions `reasoning_effort`; GPT-5.6+ reject it and take the + // Responses-style `reasoning.effort` instead. + const harmony = input.modelID.includes("openai.gpt-oss") const effort = typeof reasoning?.maxReasoningEffort === "string" ? reasoning.maxReasoningEffort : undefined const type = typeof reasoning?.type === "string" ? reasoning.type : undefined const budget = typeof reasoning?.budgetTokens === "number" ? reasoning.budgetTokens : undefined @@ -236,7 +240,10 @@ function mapBedrockRequest(input: MapInput): Pick { }, } : {}), - ...(!anthropic && openai && effort !== undefined ? { reasoning_effort: effort } : {}), + ...(!anthropic && openai && harmony && effort !== undefined ? { reasoning_effort: effort } : {}), + ...(!anthropic && openai && !harmony && effort !== undefined + ? { reasoning: { ...(isRecord(additional.reasoning) ? additional.reasoning : {}), effort } } + : {}), ...(!anthropic && !openai && effort !== undefined ? { reasoningConfig: { diff --git a/packages/core/test/aisdk-native.test.ts b/packages/core/test/aisdk-native.test.ts index 4a9ff46ef0c..bf43bbc4d66 100644 --- a/packages/core/test/aisdk-native.test.ts +++ b/packages/core/test/aisdk-native.test.ts @@ -251,11 +251,28 @@ describe("AISDKNative", () => { }, }) - for (const modelID of ["openai.gpt-oss-120b-1:0", "global.openai.gpt-5.6-sol", "us.openai.gpt-5.6-sol"]) { + // gpt-oss (Harmony) keeps the flat chat-completions field. + expect( + map("@ai-sdk/amazon-bedrock", { reasoningConfig: { maxReasoningEffort: "high" } }, "openai.gpt-oss-120b-1:0") + ?.body, + ).toEqual({ additionalModelRequestFields: { reasoning_effort: "high" } }) + + // GPT-5.6+ reject `reasoning_effort` and take the Responses-style nested field. + for (const modelID of ["global.openai.gpt-5.6-sol", "us.openai.gpt-5.6-sol", "us.openai.gpt-6-astra"]) { expect( - map("@ai-sdk/amazon-bedrock", { reasoningConfig: { maxReasoningEffort: "high" } }, modelID)?.body, - ).toEqual({ additionalModelRequestFields: { reasoning_effort: "high" } }) + map("@ai-sdk/amazon-bedrock", { reasoningConfig: { maxReasoningEffort: "none" } }, modelID)?.body, + ).toEqual({ additionalModelRequestFields: { reasoning: { effort: "none" } } }) } + expect( + map( + "@ai-sdk/amazon-bedrock", + { + reasoningConfig: { maxReasoningEffort: "high" }, + additionalModelRequestFields: { reasoning: { summary: "auto" } }, + }, + "us.openai.gpt-5.6-sol", + )?.body, + ).toEqual({ additionalModelRequestFields: { reasoning: { summary: "auto", effort: "high" } } }) }) test("maps Bedrock Mantle models to their supported native APIs", () => {