@ai-sdk/amazon-bedrock 3.0.96 → 3.0.97
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 +6 -0
- package/dist/anthropic/index.js +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/index.d.mts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +42 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
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 ? "3.0.
|
|
38
|
+
var VERSION = true ? "3.0.97" : "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 ? "3.0.
|
|
27
|
+
var VERSION = true ? "3.0.97" : "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
|
@@ -13,10 +13,21 @@ declare const bedrockProviderOptions: z.ZodObject<{
|
|
|
13
13
|
low: "low";
|
|
14
14
|
medium: "medium";
|
|
15
15
|
high: "high";
|
|
16
|
+
xhigh: "xhigh";
|
|
16
17
|
max: "max";
|
|
17
18
|
}>>;
|
|
19
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
omitted: "omitted";
|
|
21
|
+
summarized: "summarized";
|
|
22
|
+
}>>;
|
|
18
23
|
}, z.core.$strip>>;
|
|
19
24
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
default: "default";
|
|
27
|
+
reserved: "reserved";
|
|
28
|
+
priority: "priority";
|
|
29
|
+
flex: "flex";
|
|
30
|
+
}>>;
|
|
20
31
|
}, z.core.$strip>;
|
|
21
32
|
type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
|
|
22
33
|
|
package/dist/index.d.ts
CHANGED
|
@@ -13,10 +13,21 @@ declare const bedrockProviderOptions: z.ZodObject<{
|
|
|
13
13
|
low: "low";
|
|
14
14
|
medium: "medium";
|
|
15
15
|
high: "high";
|
|
16
|
+
xhigh: "xhigh";
|
|
16
17
|
max: "max";
|
|
17
18
|
}>>;
|
|
19
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
omitted: "omitted";
|
|
21
|
+
summarized: "summarized";
|
|
22
|
+
}>>;
|
|
18
23
|
}, z.core.$strip>>;
|
|
19
24
|
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
serviceTier: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
default: "default";
|
|
27
|
+
reserved: "reserved";
|
|
28
|
+
priority: "priority";
|
|
29
|
+
flex: "flex";
|
|
30
|
+
}>>;
|
|
20
31
|
}, z.core.$strip>;
|
|
21
32
|
type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
|
|
22
33
|
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.97" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/bedrock-provider.ts
|
|
36
36
|
var import_internal2 = require("@ai-sdk/anthropic/internal");
|
|
@@ -101,12 +101,23 @@ var bedrockProviderOptions = import_v4.z.object({
|
|
|
101
101
|
import_v4.z.literal("adaptive")
|
|
102
102
|
]).optional(),
|
|
103
103
|
budgetTokens: import_v4.z.number().optional(),
|
|
104
|
-
maxReasoningEffort: import_v4.z.enum(["low", "medium", "high", "max"]).optional()
|
|
104
|
+
maxReasoningEffort: import_v4.z.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
105
|
+
display: import_v4.z.enum(["omitted", "summarized"]).optional()
|
|
105
106
|
}).optional(),
|
|
106
107
|
/**
|
|
107
108
|
* Anthropic beta features to enable
|
|
108
109
|
*/
|
|
109
|
-
anthropicBeta: import_v4.z.array(import_v4.z.string()).optional()
|
|
110
|
+
anthropicBeta: import_v4.z.array(import_v4.z.string()).optional(),
|
|
111
|
+
/**
|
|
112
|
+
* Service tier for the request.
|
|
113
|
+
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/service-tiers-inference.html
|
|
114
|
+
*
|
|
115
|
+
* - 'reserved': Uses provisioned throughput capacity
|
|
116
|
+
* - 'priority': Prioritizes low-latency inference when capacity is available
|
|
117
|
+
* - 'default': Standard on-demand tier
|
|
118
|
+
* - 'flex': Lower-cost tier for flexible latency workloads
|
|
119
|
+
*/
|
|
120
|
+
serviceTier: import_v4.z.enum(["reserved", "priority", "default", "flex"]).optional()
|
|
110
121
|
});
|
|
111
122
|
|
|
112
123
|
// src/bedrock-error.ts
|
|
@@ -711,7 +722,7 @@ var BedrockChatLanguageModel = class {
|
|
|
711
722
|
toolChoice,
|
|
712
723
|
providerOptions
|
|
713
724
|
}) {
|
|
714
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
725
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
715
726
|
const bedrockOptions = (_a = await (0, import_provider_utils4.parseProviderOptions)({
|
|
716
727
|
provider: "bedrock",
|
|
717
728
|
providerOptions,
|
|
@@ -788,6 +799,7 @@ var BedrockChatLanguageModel = class {
|
|
|
788
799
|
const thinkingType = (_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type;
|
|
789
800
|
const isThinkingRequested = thinkingType === "enabled" || thinkingType === "adaptive";
|
|
790
801
|
const thinkingBudget = thinkingType === "enabled" ? (_d = bedrockOptions.reasoningConfig) == null ? void 0 : _d.budgetTokens : void 0;
|
|
802
|
+
const thinkingDisplay = thinkingType === "adaptive" ? (_e = bedrockOptions.reasoningConfig) == null ? void 0 : _e.display : void 0;
|
|
791
803
|
const isAnthropicThinkingEnabled = isAnthropicModel && isThinkingRequested;
|
|
792
804
|
const inferenceConfig = {
|
|
793
805
|
...maxOutputTokens != null && { maxTokens: maxOutputTokens },
|
|
@@ -814,12 +826,13 @@ var BedrockChatLanguageModel = class {
|
|
|
814
826
|
bedrockOptions.additionalModelRequestFields = {
|
|
815
827
|
...bedrockOptions.additionalModelRequestFields,
|
|
816
828
|
thinking: {
|
|
817
|
-
type: "adaptive"
|
|
829
|
+
type: "adaptive",
|
|
830
|
+
...thinkingDisplay != null && { display: thinkingDisplay }
|
|
818
831
|
}
|
|
819
832
|
};
|
|
820
833
|
}
|
|
821
834
|
} else if (!isAnthropicModel) {
|
|
822
|
-
if (((
|
|
835
|
+
if (((_f = bedrockOptions.reasoningConfig) == null ? void 0 : _f.budgetTokens) != null) {
|
|
823
836
|
warnings.push({
|
|
824
837
|
type: "unsupported-setting",
|
|
825
838
|
setting: "budgetTokens",
|
|
@@ -834,12 +847,12 @@ var BedrockChatLanguageModel = class {
|
|
|
834
847
|
});
|
|
835
848
|
}
|
|
836
849
|
}
|
|
837
|
-
const maxReasoningEffort = (
|
|
850
|
+
const maxReasoningEffort = (_g = bedrockOptions.reasoningConfig) == null ? void 0 : _g.maxReasoningEffort;
|
|
838
851
|
if (maxReasoningEffort != null && !isAnthropicModel) {
|
|
839
852
|
bedrockOptions.additionalModelRequestFields = {
|
|
840
853
|
...bedrockOptions.additionalModelRequestFields,
|
|
841
854
|
reasoningConfig: {
|
|
842
|
-
...((
|
|
855
|
+
...((_h = bedrockOptions.reasoningConfig) == null ? void 0 : _h.type) != null && {
|
|
843
856
|
type: bedrockOptions.reasoningConfig.type
|
|
844
857
|
},
|
|
845
858
|
maxReasoningEffort
|
|
@@ -877,7 +890,7 @@ var BedrockChatLanguageModel = class {
|
|
|
877
890
|
details: "topK is not supported when thinking is enabled"
|
|
878
891
|
});
|
|
879
892
|
}
|
|
880
|
-
const hasAnyTools = ((
|
|
893
|
+
const hasAnyTools = ((_j = (_i = toolConfig.tools) == null ? void 0 : _i.length) != null ? _j : 0) > 0 || additionalTools;
|
|
881
894
|
let filteredPrompt = prompt;
|
|
882
895
|
if (!hasAnyTools) {
|
|
883
896
|
const hasToolContent = prompt.some(
|
|
@@ -907,6 +920,7 @@ var BedrockChatLanguageModel = class {
|
|
|
907
920
|
const {
|
|
908
921
|
reasoningConfig: _,
|
|
909
922
|
additionalModelRequestFields: __,
|
|
923
|
+
serviceTier: ___,
|
|
910
924
|
...filteredBedrockOptions
|
|
911
925
|
} = (providerOptions == null ? void 0 : providerOptions.bedrock) || {};
|
|
912
926
|
const additionalModelResponseFieldPaths = isAnthropicModel ? ["/delta/stop_sequence"] : void 0;
|
|
@@ -921,6 +935,11 @@ var BedrockChatLanguageModel = class {
|
|
|
921
935
|
...Object.keys(inferenceConfig).length > 0 && {
|
|
922
936
|
inferenceConfig
|
|
923
937
|
},
|
|
938
|
+
...bedrockOptions.serviceTier != null && {
|
|
939
|
+
serviceTier: {
|
|
940
|
+
type: bedrockOptions.serviceTier
|
|
941
|
+
}
|
|
942
|
+
},
|
|
924
943
|
...filteredBedrockOptions,
|
|
925
944
|
...toolConfig.tools !== void 0 && toolConfig.tools.length > 0 ? { toolConfig } : {}
|
|
926
945
|
},
|
|
@@ -1222,6 +1241,13 @@ var BedrockChatLanguageModel = class {
|
|
|
1222
1241
|
delta: reasoningContent.text
|
|
1223
1242
|
});
|
|
1224
1243
|
} else if ("signature" in reasoningContent && reasoningContent.signature) {
|
|
1244
|
+
if (contentBlocks[blockIndex] == null) {
|
|
1245
|
+
contentBlocks[blockIndex] = { type: "reasoning" };
|
|
1246
|
+
controller.enqueue({
|
|
1247
|
+
type: "reasoning-start",
|
|
1248
|
+
id: String(blockIndex)
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1225
1251
|
controller.enqueue({
|
|
1226
1252
|
type: "reasoning-delta",
|
|
1227
1253
|
id: String(blockIndex),
|
|
@@ -1233,6 +1259,13 @@ var BedrockChatLanguageModel = class {
|
|
|
1233
1259
|
}
|
|
1234
1260
|
});
|
|
1235
1261
|
} else if ("data" in reasoningContent && reasoningContent.data) {
|
|
1262
|
+
if (contentBlocks[blockIndex] == null) {
|
|
1263
|
+
contentBlocks[blockIndex] = { type: "reasoning" };
|
|
1264
|
+
controller.enqueue({
|
|
1265
|
+
type: "reasoning-start",
|
|
1266
|
+
id: String(blockIndex)
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1236
1269
|
controller.enqueue({
|
|
1237
1270
|
type: "reasoning-delta",
|
|
1238
1271
|
id: String(blockIndex),
|