@ai-sdk/amazon-bedrock 5.0.105 → 5.0.107
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 +38 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/index.js +38 -25
- package/dist/index.js.map +1 -1
- package/dist/mantle/index.cjs +1 -1
- package/dist/mantle/index.js +1 -1
- package/docs/08-amazon-bedrock.mdx +18 -0
- package/package.json +7 -7
- package/src/amazon-bedrock-chat-language-model.ts +59 -37
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 5.0.107
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 268225c: feat(provider): add a portable `max` reasoning level with native provider mappings, compatibility coercions, and budget-based fallback support.
|
|
8
|
+
|
|
9
|
+
Compatibility notes:
|
|
10
|
+
|
|
11
|
+
- **TypeScript source compatibility:** Adding `max` widens `LanguageModelV4CallOptions['reasoning']` and the derived `ReasoningLevel` type. Third-party providers and consumers with exhaustive switches or `Record<ReasoningLevel, ...>` mappings must handle `max` before upgrading. Ordinary calls using existing reasoning levels remain accepted.
|
|
12
|
+
- **Amazon Bedrock:** Existing Nova 2 calls using portable `reasoning: 'xhigh'` now send `maxReasoningEffort: 'high'` instead of the unsupported `'max'`, and return a compatibility warning. Anthropic and OpenAI Bedrock effort mappings retain their existing `xhigh` behavior. Partial Bedrock reasoning configurations continue to preserve explicit values and derive missing fields; explicit effort/budget overrides and disabled thinking no longer emit warnings for portable mappings that are not sent.
|
|
13
|
+
- **Fireworks:** Existing portable `minimal` and `xhigh` calls keep their request mappings to `low` and `high`, respectively, and now return compatibility warnings in generation and streaming results. Portable `max` maps to `high` with the same warning behavior.
|
|
14
|
+
|
|
15
|
+
**Release classification:** This remains a patch changeset under the repository's explicit release policy, which uses patch releases for both fixes and features. The TypeScript source-compatibility caveat for exhaustive consumers is disclosed above. Maintainers can override this classification with a `major` label if they decide to align the provider-spec addition with a future AI SDK major release.
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [fc1e19e]
|
|
18
|
+
- Updated dependencies [5094ebd]
|
|
19
|
+
- Updated dependencies [99bdcd2]
|
|
20
|
+
- Updated dependencies [268225c]
|
|
21
|
+
- Updated dependencies [0af2f7c]
|
|
22
|
+
- @ai-sdk/provider-utils@5.0.55
|
|
23
|
+
- @ai-sdk/openai@4.0.85
|
|
24
|
+
- @ai-sdk/anthropic@4.0.73
|
|
25
|
+
- @ai-sdk/provider@4.0.23
|
|
26
|
+
|
|
27
|
+
## 5.0.106
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Updated dependencies [2959d35]
|
|
32
|
+
- Updated dependencies [b5dfea1]
|
|
33
|
+
- Updated dependencies [686cca9]
|
|
34
|
+
- Updated dependencies [5b8e63b]
|
|
35
|
+
- Updated dependencies [59116e6]
|
|
36
|
+
- @ai-sdk/provider@4.0.22
|
|
37
|
+
- @ai-sdk/provider-utils@5.0.54
|
|
38
|
+
- @ai-sdk/openai@4.0.84
|
|
39
|
+
- @ai-sdk/anthropic@4.0.72
|
|
40
|
+
|
|
3
41
|
## 5.0.105
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/dist/anthropic/index.js
CHANGED
|
@@ -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.
|
|
9
|
+
const VERSION = "5.0.107";
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/amazon-bedrock-sigv4-fetch.ts
|
|
12
12
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1882,54 +1882,71 @@ const amazonBedrockReasoningEffortMap = {
|
|
|
1882
1882
|
low: "low",
|
|
1883
1883
|
medium: "medium",
|
|
1884
1884
|
high: "high",
|
|
1885
|
-
xhigh: "max"
|
|
1885
|
+
xhigh: "max",
|
|
1886
|
+
max: "max"
|
|
1887
|
+
};
|
|
1888
|
+
const amazonNovaReasoningEffortMap = {
|
|
1889
|
+
minimal: "low",
|
|
1890
|
+
low: "low",
|
|
1891
|
+
medium: "medium",
|
|
1892
|
+
high: "high",
|
|
1893
|
+
xhigh: "high",
|
|
1894
|
+
max: "high"
|
|
1886
1895
|
};
|
|
1887
1896
|
function isNova2ReasoningModel(modelId) {
|
|
1888
1897
|
return modelId.includes("amazon.nova-2-lite-v1:0");
|
|
1889
1898
|
}
|
|
1890
1899
|
function resolveAmazonBedrockReasoningConfig({ reasoning, amazonBedrockOptions, warnings, isAnthropicModel, isOpenAIModel, modelId }) {
|
|
1900
|
+
const reasoningConfig = amazonBedrockOptions.reasoningConfig;
|
|
1891
1901
|
if (!isCustomReasoning(reasoning)) return amazonBedrockOptions;
|
|
1892
1902
|
const result = { ...amazonBedrockOptions };
|
|
1903
|
+
if (reasoningConfig?.type === "disabled") {
|
|
1904
|
+
result.reasoningConfig = { ...reasoningConfig };
|
|
1905
|
+
delete result.reasoningConfig.maxReasoningEffort;
|
|
1906
|
+
delete result.reasoningConfig.budgetTokens;
|
|
1907
|
+
return result;
|
|
1908
|
+
}
|
|
1893
1909
|
const hasPortableReasoning = reasoning !== "none";
|
|
1894
|
-
const hasExplicitReasoningConfig = amazonBedrockOptions.reasoningConfig != null;
|
|
1895
1910
|
const isNovaReasoningModel = isNova2ReasoningModel(modelId);
|
|
1896
|
-
const supportsPortableReasoning = isOpenAIModel || isNovaReasoningModel;
|
|
1911
|
+
const supportsPortableReasoning = isOpenAIModel || isNovaReasoningModel || reasoningConfig != null;
|
|
1897
1912
|
if (isAnthropicModel) {
|
|
1898
1913
|
const capabilities = getModelCapabilities(modelId);
|
|
1899
1914
|
if (reasoning === "none") result.reasoningConfig = { type: "disabled" };
|
|
1900
|
-
else if (capabilities.supportsAdaptiveThinking)
|
|
1901
|
-
|
|
1902
|
-
maxReasoningEffort: mapReasoningToProviderEffort({
|
|
1915
|
+
else if (capabilities.supportsAdaptiveThinking) {
|
|
1916
|
+
const effort = reasoningConfig?.maxReasoningEffort ?? mapReasoningToProviderEffort({
|
|
1903
1917
|
reasoning,
|
|
1904
1918
|
effortMap: amazonBedrockReasoningEffortMap,
|
|
1905
1919
|
warnings
|
|
1906
|
-
})
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1920
|
+
});
|
|
1921
|
+
result.reasoningConfig = {
|
|
1922
|
+
...reasoningConfig,
|
|
1923
|
+
type: reasoningConfig?.type ?? "adaptive",
|
|
1924
|
+
maxReasoningEffort: effort
|
|
1925
|
+
};
|
|
1926
|
+
} else {
|
|
1927
|
+
const budgetTokens = reasoningConfig?.budgetTokens ?? mapReasoningToProviderBudget({
|
|
1911
1928
|
reasoning,
|
|
1912
1929
|
maxOutputTokens: capabilities.maxOutputTokens,
|
|
1913
1930
|
maxReasoningBudget: capabilities.maxOutputTokens,
|
|
1914
1931
|
warnings
|
|
1915
1932
|
});
|
|
1916
1933
|
if (budgetTokens != null) result.reasoningConfig = {
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1934
|
+
...reasoningConfig,
|
|
1935
|
+
type: reasoningConfig?.type ?? "enabled",
|
|
1936
|
+
budgetTokens
|
|
1920
1937
|
};
|
|
1921
1938
|
}
|
|
1922
1939
|
} else if (hasPortableReasoning) {
|
|
1923
|
-
if (supportsPortableReasoning
|
|
1924
|
-
const effort = mapReasoningToProviderEffort({
|
|
1940
|
+
if (supportsPortableReasoning) {
|
|
1941
|
+
const effort = reasoningConfig?.maxReasoningEffort ?? mapReasoningToProviderEffort({
|
|
1925
1942
|
reasoning,
|
|
1926
|
-
effortMap: amazonBedrockReasoningEffortMap,
|
|
1943
|
+
effortMap: isNovaReasoningModel ? amazonNovaReasoningEffortMap : amazonBedrockReasoningEffortMap,
|
|
1927
1944
|
warnings
|
|
1928
1945
|
});
|
|
1929
1946
|
result.reasoningConfig = {
|
|
1930
|
-
...
|
|
1931
|
-
|
|
1932
|
-
|
|
1947
|
+
...reasoningConfig,
|
|
1948
|
+
...isNovaReasoningModel && { type: reasoningConfig?.type ?? "enabled" },
|
|
1949
|
+
maxReasoningEffort: effort
|
|
1933
1950
|
};
|
|
1934
1951
|
} else warnings.push({
|
|
1935
1952
|
type: "unsupported",
|
|
@@ -1937,10 +1954,6 @@ function resolveAmazonBedrockReasoningConfig({ reasoning, amazonBedrockOptions,
|
|
|
1937
1954
|
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."
|
|
1938
1955
|
});
|
|
1939
1956
|
}
|
|
1940
|
-
if (result.reasoningConfig?.type === "disabled") {
|
|
1941
|
-
delete result.reasoningConfig.maxReasoningEffort;
|
|
1942
|
-
delete result.reasoningConfig.budgetTokens;
|
|
1943
|
-
}
|
|
1944
1957
|
return result;
|
|
1945
1958
|
}
|
|
1946
1959
|
//#endregion
|
|
@@ -2329,7 +2342,7 @@ const amazonBedrockImageResponseSchema = z.object({
|
|
|
2329
2342
|
});
|
|
2330
2343
|
//#endregion
|
|
2331
2344
|
//#region src/version.ts
|
|
2332
|
-
const VERSION = "5.0.
|
|
2345
|
+
const VERSION = "5.0.107";
|
|
2333
2346
|
//#endregion
|
|
2334
2347
|
//#region src/amazon-bedrock-sigv4-fetch.ts
|
|
2335
2348
|
/**
|