- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.2k
Closed
Labels
ai/providerbugSomething isn't workingSomething isn't workingprovider/amazon-bedrockIssues related to the @ai-sdk/amazon-bedrock providerIssues related to the @ai-sdk/amazon-bedrock providerprovider/anthropicreproduction provided
Description
Description
With additionalModelRequestFields set, reasoning doesn't work anymore.
In a10bf62 - filtering out reasoningConfig was added, but that leaves potential additionalModelRequestFields in, which overwrites the additionalModelRequestFields that includes the reasoningConfig.
Repro:
import { bedrock } from "@ai-sdk/amazon-bedrock";
import { stepCountIs, streamText } from "ai";
import "dotenv/config";
async function main() {
  const result = streamText({
    model: bedrock("us.anthropic.claude-3-7-sonnet-20250219-v1:0"),
    prompt: 'How many "r"s are in the word "strawberry"?',
    onError: (error) => console.error(error),
    providerOptions: {
      bedrock: {
        reasoningConfig: { type: "enabled", budgetTokens: 1024 },
        // removing this line below makes reasoning work again
        additionalModelRequestFields: {},
      },
    },
    maxRetries: 0,
    stopWhen: stepCountIs(5),
  });
  for await (const part of result.fullStream) {
    if (part.type === "reasoning-delta") {
      process.stdout.write("\x1b[34m" + part.text + "\x1b[0m");
    } else if (part.type === "text-delta") {
      process.stdout.write(part.text);
    }
  }
  console.log();
  console.log("Warnings:", await result.warnings);
}
main().catch(console.error);AI SDK Version
"@ai-sdk/amazon-bedrock": "^4.0.0-beta.18",
"ai": "^6.0.0-beta.31"
also happens on
"@ai-sdk/amazon-bedrock": "^3.0.31",
"ai": "^5.0.61"
Code of Conduct
- I agree to follow this project's Code of Conduct
gr2m
Metadata
Metadata
Assignees
Labels
ai/providerbugSomething isn't workingSomething isn't workingprovider/amazon-bedrockIssues related to the @ai-sdk/amazon-bedrock providerIssues related to the @ai-sdk/amazon-bedrock providerprovider/anthropicreproduction provided