@ai-sdk/amazon-bedrock 5.0.127 → 5.0.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 5.0.128
4
+
5
+ ### Patch Changes
6
+
7
+ - 61a315e: fix: map the top-level `reasoning` option consistently across providers
8
+
9
+ Providers now resolve reasoning the same way:
10
+
11
+ 1. A provider-specific reasoning setting in `providerOptions` is sent unchanged. OpenAI no longer drops `providerOptions.openai.reasoningEffort` values that are not in its list for the model, and Fireworks no longer rewrites `providerOptions.fireworks.reasoningEffort`. Fireworks also sends top-level `reasoning` values directly instead of rounding them to `'high'` at most, except for model families known to reject `'none'` (GPT-OSS, GLM-5.3, Muse Spark) or `'minimal'` (Nemotron, Inkling).
12
+ 2. Otherwise, `reasoning` maps to the closest level the model supports, rounding down, and rounds up only when there is no lower level. For example, `'xhigh'` now maps to `'high'` instead of `'max'` on Anthropic and Bedrock models without `xhigh` effort, and `'medium'` maps to `'low'` instead of `'high'` on DeepSeek, Kimi K3, and Mistral GLM-5.3 models.
13
+ 3. `'none'` on a model that cannot disable reasoning maps to the model's lowest level with a compatibility warning, instead of being dropped or sending a request the API rejects. This affects GPT-6 models without `'none'`, xAI grok-4.5 and later, Groq GPT-OSS, Kimi K3, Perplexity, QuiverAI, Bedrock OpenAI `gpt-oss` models, and Gemini 2.5 Pro (minimum thinking budget). Gemini 3 and Anthropic and Bedrock `between_tools` mappings now emit the compatibility warning too.
14
+
15
+ `mapReasoningToProviderEffort` now accepts any `reasoning` value, returns an optional `providerOptionsEffort` unchanged, and rounds levels that are missing from the effort map to the closest supported level. `mapReasoningToProviderBudget` maps `'none'` to the minimum reasoning budget, always returns a budget, and uses the default percentage for levels missing from `budgetPercentages`. `OpenAICompatibleChatConfig` adds an optional `mapReasoning` function for mapping the top-level `reasoning` option.
16
+
17
+ - Updated dependencies [47b1d8b]
18
+ - Updated dependencies [d07b475]
19
+ - Updated dependencies [61a315e]
20
+ - @ai-sdk/openai@4.0.105
21
+ - @ai-sdk/provider-utils@5.0.71
22
+ - @ai-sdk/anthropic@4.0.92
23
+
3
24
  ## 5.0.127
4
25
 
5
26
  ### Patch Changes
@@ -6,7 +6,7 @@ import { z } from "zod/v4";
6
6
  import { EventStreamCodec } from "@smithy/eventstream-codec";
7
7
  import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
8
8
  //#region src/version.ts
9
- const VERSION = "5.0.127";
9
+ const VERSION = "5.0.128";
10
10
  //#endregion
11
11
  //#region src/amazon-bedrock-sigv4-fetch.ts
12
12
  /**
package/dist/index.js CHANGED
@@ -1110,7 +1110,7 @@ var AmazonBedrockChatLanguageModel = class AmazonBedrockChatLanguageModel {
1110
1110
  maxReasoningEffort ??= explicitReasoningEffort;
1111
1111
  if (maxReasoningEffort == null && amazonBedrockOptions.additionalModelRequestFields?.output_config?.effort == null) maxReasoningEffort = "low";
1112
1112
  }
1113
- if (hasExplicitDisabledThinking || thinkingType === "adaptive") warnings.push({
1113
+ warnings.push({
1114
1114
  type: hasExplicitDisabledThinking ? "unsupported" : "compatibility",
1115
1115
  feature: hasExplicitDisabledThinking ? "providerOptions.amazonBedrock.reasoningConfig" : "reasoning",
1116
1116
  details: `thinking cannot be disabled for ${this.modelId}. Using '${thinkingType}' thinking instead.`
@@ -1910,20 +1910,29 @@ const AmazonBedrockStreamSchema = z.object({
1910
1910
  validationException: z.record(z.string(), z.unknown()).nullish()
1911
1911
  });
1912
1912
  const amazonBedrockReasoningEffortMap = {
1913
- minimal: "low",
1914
1913
  low: "low",
1915
1914
  medium: "medium",
1916
1915
  high: "high",
1917
- xhigh: "max",
1918
1916
  max: "max"
1919
1917
  };
1920
1918
  const amazonNovaReasoningEffortMap = {
1921
- minimal: "low",
1919
+ low: "low",
1920
+ medium: "medium",
1921
+ high: "high"
1922
+ };
1923
+ const openAIGptOssReasoningEffortMap = {
1924
+ low: "low",
1925
+ medium: "medium",
1926
+ high: "high"
1927
+ };
1928
+ const openAIReasoningEffortMap = {
1929
+ none: "none",
1930
+ minimal: "minimal",
1922
1931
  low: "low",
1923
1932
  medium: "medium",
1924
1933
  high: "high",
1925
- xhigh: "high",
1926
- max: "high"
1934
+ xhigh: "xhigh",
1935
+ max: "max"
1927
1936
  };
1928
1937
  function isNova2ReasoningModel(modelId) {
1929
1938
  return modelId.includes("amazon.nova-2-lite-v1:0");
@@ -1938,7 +1947,6 @@ function resolveAmazonBedrockReasoningConfig({ reasoning, amazonBedrockOptions,
1938
1947
  delete result.reasoningConfig.budgetTokens;
1939
1948
  return result;
1940
1949
  }
1941
- const hasPortableReasoning = reasoning !== "none";
1942
1950
  const isNovaReasoningModel = isNova2ReasoningModel(modelId);
1943
1951
  const supportsPortableReasoning = isOpenAIModel || isNovaReasoningModel || reasoningConfig != null;
1944
1952
  if (isAnthropicModel) {
@@ -1947,7 +1955,10 @@ function resolveAmazonBedrockReasoningConfig({ reasoning, amazonBedrockOptions,
1947
1955
  else if (capabilities.supportsAdaptiveThinking) {
1948
1956
  const effort = reasoningConfig?.maxReasoningEffort ?? mapReasoningToProviderEffort({
1949
1957
  reasoning,
1950
- effortMap: amazonBedrockReasoningEffortMap,
1958
+ effortMap: {
1959
+ ...amazonBedrockReasoningEffortMap,
1960
+ ...capabilities.supportsXhighEffort && { xhigh: "xhigh" }
1961
+ },
1951
1962
  warnings
1952
1963
  });
1953
1964
  result.reasoningConfig = {
@@ -1962,30 +1973,28 @@ function resolveAmazonBedrockReasoningConfig({ reasoning, amazonBedrockOptions,
1962
1973
  maxReasoningBudget: capabilities.maxOutputTokens,
1963
1974
  warnings
1964
1975
  });
1965
- if (budgetTokens != null) result.reasoningConfig = {
1976
+ result.reasoningConfig = {
1966
1977
  ...reasoningConfig,
1967
1978
  type: reasoningConfig?.type ?? "enabled",
1968
1979
  budgetTokens
1969
1980
  };
1970
1981
  }
1971
- } else if (hasPortableReasoning) {
1972
- if (supportsPortableReasoning) {
1973
- const effort = reasoningConfig?.maxReasoningEffort ?? mapReasoningToProviderEffort({
1974
- reasoning,
1975
- effortMap: isNovaReasoningModel ? amazonNovaReasoningEffortMap : amazonBedrockReasoningEffortMap,
1976
- warnings
1977
- });
1978
- result.reasoningConfig = {
1979
- ...reasoningConfig,
1980
- ...isNovaReasoningModel && { type: reasoningConfig?.type ?? "enabled" },
1981
- maxReasoningEffort: effort
1982
- };
1983
- } else warnings.push({
1984
- type: "unsupported",
1985
- feature: "reasoning",
1986
- details: "Portable reasoning is not supported for this model and will be ignored. If the model supports a provider-specific reasoning configuration, use providerOptions.amazonBedrock.reasoningConfig."
1982
+ } else if (reasoning === "none" && isNovaReasoningModel) {} else if (supportsPortableReasoning) {
1983
+ const effort = reasoningConfig?.maxReasoningEffort ?? mapReasoningToProviderEffort({
1984
+ reasoning,
1985
+ effortMap: isNovaReasoningModel ? amazonNovaReasoningEffortMap : isOpenAIModel ? modelId.includes("openai.gpt-oss-") ? openAIGptOssReasoningEffortMap : openAIReasoningEffortMap : amazonBedrockReasoningEffortMap,
1986
+ warnings
1987
1987
  });
1988
- }
1988
+ result.reasoningConfig = {
1989
+ ...reasoningConfig,
1990
+ ...isNovaReasoningModel && { type: reasoningConfig?.type ?? "enabled" },
1991
+ maxReasoningEffort: effort
1992
+ };
1993
+ } else warnings.push({
1994
+ type: "unsupported",
1995
+ feature: "reasoning",
1996
+ details: "Portable reasoning is not supported for this model and will be ignored. If the model supports a provider-specific reasoning configuration, use providerOptions.amazonBedrock.reasoningConfig."
1997
+ });
1989
1998
  return result;
1990
1999
  }
1991
2000
  //#endregion
@@ -2374,7 +2383,7 @@ const amazonBedrockImageResponseSchema = lazySchema(() => zodSchema(z.object({
2374
2383
  })));
2375
2384
  //#endregion
2376
2385
  //#region src/version.ts
2377
- const VERSION = "5.0.127";
2386
+ const VERSION = "5.0.128";
2378
2387
  //#endregion
2379
2388
  //#region src/amazon-bedrock-sigv4-fetch.ts
2380
2389
  /**