@ai-sdk/amazon-bedrock 4.0.94 → 4.0.96
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 +13 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +26 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/bedrock-chat-language-model.ts +19 -0
- package/src/bedrock-chat-options.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 4.0.96
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fd0f097: fix(provider/amazon-bedrock): fix Anthropic reasoning behavior related to Opus 4.7
|
|
8
|
+
|
|
9
|
+
## 4.0.95
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [95b4fe0]
|
|
14
|
+
- @ai-sdk/anthropic@3.0.71
|
|
15
|
+
|
|
3
16
|
## 4.0.94
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/anthropic/index.js
CHANGED
|
@@ -35,7 +35,7 @@ var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
|
35
35
|
var import_aws4fetch = require("aws4fetch");
|
|
36
36
|
|
|
37
37
|
// src/version.ts
|
|
38
|
-
var VERSION = true ? "4.0.
|
|
38
|
+
var VERSION = true ? "4.0.96" : "0.0.0-test";
|
|
39
39
|
|
|
40
40
|
// src/bedrock-sigv4-fetch.ts
|
|
41
41
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
package/dist/anthropic/index.mjs
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import { AwsV4Signer } from "aws4fetch";
|
|
25
25
|
|
|
26
26
|
// src/version.ts
|
|
27
|
-
var VERSION = true ? "4.0.
|
|
27
|
+
var VERSION = true ? "4.0.96" : "0.0.0-test";
|
|
28
28
|
|
|
29
29
|
// src/bedrock-sigv4-fetch.ts
|
|
30
30
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|
package/dist/index.d.mts
CHANGED
|
@@ -45,8 +45,13 @@ declare const amazonBedrockLanguageModelOptions: z.ZodObject<{
|
|
|
45
45
|
low: "low";
|
|
46
46
|
medium: "medium";
|
|
47
47
|
high: "high";
|
|
48
|
+
xhigh: "xhigh";
|
|
48
49
|
max: "max";
|
|
49
50
|
}>>;
|
|
51
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
omitted: "omitted";
|
|
53
|
+
summarized: "summarized";
|
|
54
|
+
}>>;
|
|
50
55
|
}, z.core.$strip>>;
|
|
51
56
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
57
|
serviceTier: z.ZodOptional<z.ZodEnum<{
|
package/dist/index.d.ts
CHANGED
|
@@ -45,8 +45,13 @@ declare const amazonBedrockLanguageModelOptions: z.ZodObject<{
|
|
|
45
45
|
low: "low";
|
|
46
46
|
medium: "medium";
|
|
47
47
|
high: "high";
|
|
48
|
+
xhigh: "xhigh";
|
|
48
49
|
max: "max";
|
|
49
50
|
}>>;
|
|
51
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
52
|
+
omitted: "omitted";
|
|
53
|
+
summarized: "summarized";
|
|
54
|
+
}>>;
|
|
50
55
|
}, z.core.$strip>>;
|
|
51
56
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
57
|
serviceTier: z.ZodOptional<z.ZodEnum<{
|
package/dist/index.js
CHANGED
|
@@ -93,7 +93,8 @@ var amazonBedrockLanguageModelOptions = import_v4.z.object({
|
|
|
93
93
|
import_v4.z.literal("adaptive")
|
|
94
94
|
]).optional(),
|
|
95
95
|
budgetTokens: import_v4.z.number().optional(),
|
|
96
|
-
maxReasoningEffort: import_v4.z.enum(["low", "medium", "high", "max"]).optional()
|
|
96
|
+
maxReasoningEffort: import_v4.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
97
|
+
display: import_v4.z.enum(["omitted", "summarized"]).optional()
|
|
97
98
|
}).optional(),
|
|
98
99
|
/**
|
|
99
100
|
* Anthropic beta features to enable
|
|
@@ -787,7 +788,7 @@ var BedrockChatLanguageModel = class {
|
|
|
787
788
|
toolChoice,
|
|
788
789
|
providerOptions
|
|
789
790
|
}) {
|
|
790
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
791
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
791
792
|
const bedrockOptions = (_a = await (0, import_provider_utils4.parseProviderOptions)({
|
|
792
793
|
provider: "bedrock",
|
|
793
794
|
providerOptions,
|
|
@@ -865,6 +866,7 @@ var BedrockChatLanguageModel = class {
|
|
|
865
866
|
}
|
|
866
867
|
const thinkingType = (_e = bedrockOptions.reasoningConfig) == null ? void 0 : _e.type;
|
|
867
868
|
const thinkingBudget = thinkingType === "enabled" ? (_f = bedrockOptions.reasoningConfig) == null ? void 0 : _f.budgetTokens : void 0;
|
|
869
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_g = bedrockOptions.reasoningConfig) == null ? void 0 : _g.display : void 0;
|
|
868
870
|
const isAnthropicThinkingEnabled = isAnthropicModel && isThinkingEnabled;
|
|
869
871
|
const inferenceConfig = {
|
|
870
872
|
...maxOutputTokens != null && { maxTokens: maxOutputTokens },
|
|
@@ -891,12 +893,13 @@ var BedrockChatLanguageModel = class {
|
|
|
891
893
|
bedrockOptions.additionalModelRequestFields = {
|
|
892
894
|
...bedrockOptions.additionalModelRequestFields,
|
|
893
895
|
thinking: {
|
|
894
|
-
type: "adaptive"
|
|
896
|
+
type: "adaptive",
|
|
897
|
+
...thinkingDisplay != null && { display: thinkingDisplay }
|
|
895
898
|
}
|
|
896
899
|
};
|
|
897
900
|
}
|
|
898
901
|
} else if (!isAnthropicModel) {
|
|
899
|
-
if (((
|
|
902
|
+
if (((_h = bedrockOptions.reasoningConfig) == null ? void 0 : _h.budgetTokens) != null) {
|
|
900
903
|
warnings.push({
|
|
901
904
|
type: "unsupported",
|
|
902
905
|
feature: "budgetTokens",
|
|
@@ -911,14 +914,14 @@ var BedrockChatLanguageModel = class {
|
|
|
911
914
|
});
|
|
912
915
|
}
|
|
913
916
|
}
|
|
914
|
-
const maxReasoningEffort = (
|
|
917
|
+
const maxReasoningEffort = (_i = bedrockOptions.reasoningConfig) == null ? void 0 : _i.maxReasoningEffort;
|
|
915
918
|
const isOpenAIModel = this.modelId.startsWith("openai.");
|
|
916
919
|
if (maxReasoningEffort != null) {
|
|
917
920
|
if (isAnthropicModel) {
|
|
918
921
|
bedrockOptions.additionalModelRequestFields = {
|
|
919
922
|
...bedrockOptions.additionalModelRequestFields,
|
|
920
923
|
output_config: {
|
|
921
|
-
...(
|
|
924
|
+
...(_j = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _j.output_config,
|
|
922
925
|
effort: maxReasoningEffort
|
|
923
926
|
}
|
|
924
927
|
};
|
|
@@ -942,7 +945,7 @@ var BedrockChatLanguageModel = class {
|
|
|
942
945
|
bedrockOptions.additionalModelRequestFields = {
|
|
943
946
|
...bedrockOptions.additionalModelRequestFields,
|
|
944
947
|
output_config: {
|
|
945
|
-
...(
|
|
948
|
+
...(_k = bedrockOptions.additionalModelRequestFields) == null ? void 0 : _k.output_config,
|
|
946
949
|
format: {
|
|
947
950
|
type: "json_schema",
|
|
948
951
|
schema: responseFormat.schema
|
|
@@ -974,7 +977,7 @@ var BedrockChatLanguageModel = class {
|
|
|
974
977
|
details: "topK is not supported when thinking is enabled"
|
|
975
978
|
});
|
|
976
979
|
}
|
|
977
|
-
const hasAnyTools = ((
|
|
980
|
+
const hasAnyTools = ((_m = (_l = toolConfig.tools) == null ? void 0 : _l.length) != null ? _m : 0) > 0 || additionalTools;
|
|
978
981
|
let filteredPrompt = prompt;
|
|
979
982
|
if (!hasAnyTools) {
|
|
980
983
|
const hasToolContent = prompt.some(
|
|
@@ -1363,6 +1366,13 @@ var BedrockChatLanguageModel = class {
|
|
|
1363
1366
|
delta: reasoningContent.text
|
|
1364
1367
|
});
|
|
1365
1368
|
} else if ("signature" in reasoningContent && reasoningContent.signature) {
|
|
1369
|
+
if (contentBlocks[blockIndex] == null) {
|
|
1370
|
+
contentBlocks[blockIndex] = { type: "reasoning" };
|
|
1371
|
+
controller.enqueue({
|
|
1372
|
+
type: "reasoning-start",
|
|
1373
|
+
id: String(blockIndex)
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1366
1376
|
controller.enqueue({
|
|
1367
1377
|
type: "reasoning-delta",
|
|
1368
1378
|
id: String(blockIndex),
|
|
@@ -1374,6 +1384,13 @@ var BedrockChatLanguageModel = class {
|
|
|
1374
1384
|
}
|
|
1375
1385
|
});
|
|
1376
1386
|
} else if ("data" in reasoningContent && reasoningContent.data) {
|
|
1387
|
+
if (contentBlocks[blockIndex] == null) {
|
|
1388
|
+
contentBlocks[blockIndex] = { type: "reasoning" };
|
|
1389
|
+
controller.enqueue({
|
|
1390
|
+
type: "reasoning-start",
|
|
1391
|
+
id: String(blockIndex)
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1377
1394
|
controller.enqueue({
|
|
1378
1395
|
type: "reasoning-delta",
|
|
1379
1396
|
id: String(blockIndex),
|
|
@@ -1971,7 +1988,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
|
1971
1988
|
var import_aws4fetch = require("aws4fetch");
|
|
1972
1989
|
|
|
1973
1990
|
// src/version.ts
|
|
1974
|
-
var VERSION = true ? "4.0.
|
|
1991
|
+
var VERSION = true ? "4.0.96" : "0.0.0-test";
|
|
1975
1992
|
|
|
1976
1993
|
// src/bedrock-sigv4-fetch.ts
|
|
1977
1994
|
function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
|