@ai-sdk/amazon-bedrock 3.0.0-beta.1 → 3.0.0-beta.3
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 +16 -0
- package/dist/index.d.mts +4 -27
- package/dist/index.d.ts +4 -27
- package/dist/index.js +140 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/amazon-bedrock
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3593385: fix(bedrock): resolve mime-types of document and images
|
|
8
|
+
|
|
9
|
+
## 3.0.0-beta.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d1a034f: feature: using Zod 4 for internal stuff
|
|
14
|
+
- Updated dependencies [0571b98]
|
|
15
|
+
- Updated dependencies [39a4fab]
|
|
16
|
+
- Updated dependencies [d1a034f]
|
|
17
|
+
- @ai-sdk/provider-utils@3.0.0-beta.2
|
|
18
|
+
|
|
3
19
|
## 3.0.0-beta.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | (string & {});
|
|
6
6
|
declare const bedrockProviderOptions: z.ZodObject<{
|
|
7
|
-
/**
|
|
8
|
-
* Additional inference parameters that the model supports,
|
|
9
|
-
* beyond the base set of inference parameters that Converse
|
|
10
|
-
* supports in the inferenceConfig field
|
|
11
|
-
*/
|
|
12
7
|
additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
13
8
|
reasoningConfig: z.ZodOptional<z.ZodObject<{
|
|
14
|
-
type: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>>;
|
|
9
|
+
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>>;
|
|
15
10
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
budgetTokens?: number | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
type?: "enabled" | "disabled" | undefined;
|
|
21
|
-
budgetTokens?: number | undefined;
|
|
22
|
-
}>>;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
additionalModelRequestFields?: Record<string, any> | undefined;
|
|
25
|
-
reasoningConfig?: {
|
|
26
|
-
type?: "enabled" | "disabled" | undefined;
|
|
27
|
-
budgetTokens?: number | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
}, {
|
|
30
|
-
additionalModelRequestFields?: Record<string, any> | undefined;
|
|
31
|
-
reasoningConfig?: {
|
|
32
|
-
type?: "enabled" | "disabled" | undefined;
|
|
33
|
-
budgetTokens?: number | undefined;
|
|
34
|
-
} | undefined;
|
|
35
|
-
}>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
36
13
|
type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
|
|
37
14
|
|
|
38
15
|
type BedrockEmbeddingModelId = 'amazon.titan-embed-text-v1' | 'amazon.titan-embed-text-v2:0' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,38 +1,15 @@
|
|
|
1
1
|
import { ProviderV2, LanguageModelV2, EmbeddingModelV2, ImageModelV2 } from '@ai-sdk/provider';
|
|
2
2
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { z } from 'zod';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-3-7-sonnet-20250219-v1:0' | 'anthropic.claude-3-5-sonnet-20240620-v1:0' | 'anthropic.claude-3-5-sonnet-20241022-v2:0' | 'anthropic.claude-3-5-haiku-20241022-v1:0' | 'anthropic.claude-3-sonnet-20240229-v1:0' | 'anthropic.claude-3-haiku-20240307-v1:0' | 'anthropic.claude-3-opus-20240229-v1:0' | 'cohere.command-text-v14' | 'cohere.command-light-text-v14' | 'cohere.command-r-v1:0' | 'cohere.command-r-plus-v1:0' | 'meta.llama3-70b-instruct-v1:0' | 'meta.llama3-8b-instruct-v1:0' | 'meta.llama3-1-405b-instruct-v1:0' | 'meta.llama3-1-70b-instruct-v1:0' | 'meta.llama3-1-8b-instruct-v1:0' | 'meta.llama3-2-11b-instruct-v1:0' | 'meta.llama3-2-1b-instruct-v1:0' | 'meta.llama3-2-3b-instruct-v1:0' | 'meta.llama3-2-90b-instruct-v1:0' | 'mistral.mistral-7b-instruct-v0:2' | 'mistral.mixtral-8x7b-instruct-v0:1' | 'mistral.mistral-large-2402-v1:0' | 'mistral.mistral-small-2402-v1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | (string & {});
|
|
6
6
|
declare const bedrockProviderOptions: z.ZodObject<{
|
|
7
|
-
/**
|
|
8
|
-
* Additional inference parameters that the model supports,
|
|
9
|
-
* beyond the base set of inference parameters that Converse
|
|
10
|
-
* supports in the inferenceConfig field
|
|
11
|
-
*/
|
|
12
7
|
additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
13
8
|
reasoningConfig: z.ZodOptional<z.ZodObject<{
|
|
14
|
-
type: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>>;
|
|
9
|
+
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>>;
|
|
15
10
|
budgetTokens: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
budgetTokens?: number | undefined;
|
|
19
|
-
}, {
|
|
20
|
-
type?: "enabled" | "disabled" | undefined;
|
|
21
|
-
budgetTokens?: number | undefined;
|
|
22
|
-
}>>;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
additionalModelRequestFields?: Record<string, any> | undefined;
|
|
25
|
-
reasoningConfig?: {
|
|
26
|
-
type?: "enabled" | "disabled" | undefined;
|
|
27
|
-
budgetTokens?: number | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
}, {
|
|
30
|
-
additionalModelRequestFields?: Record<string, any> | undefined;
|
|
31
|
-
reasoningConfig?: {
|
|
32
|
-
type?: "enabled" | "disabled" | undefined;
|
|
33
|
-
budgetTokens?: number | undefined;
|
|
34
|
-
} | undefined;
|
|
35
|
-
}>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
36
13
|
type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
|
|
37
14
|
|
|
38
15
|
type BedrockEmbeddingModelId = 'amazon.titan-embed-text-v1' | 'amazon.titan-embed-text-v2:0' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | (string & {});
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
|
30
30
|
|
|
31
31
|
// src/bedrock-chat-language-model.ts
|
|
32
32
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
33
|
-
var
|
|
33
|
+
var import_v43 = require("zod/v4");
|
|
34
34
|
|
|
35
35
|
// src/bedrock-api-types.ts
|
|
36
36
|
var BEDROCK_CACHE_POINT = {
|
|
@@ -48,27 +48,44 @@ var BEDROCK_STOP_REASONS = [
|
|
|
48
48
|
"tool-calls",
|
|
49
49
|
"tool_use"
|
|
50
50
|
];
|
|
51
|
+
var BEDROCK_IMAGE_MIME_TYPES = {
|
|
52
|
+
"image/jpeg": "jpeg",
|
|
53
|
+
"image/png": "png",
|
|
54
|
+
"image/gif": "gif",
|
|
55
|
+
"image/webp": "webp"
|
|
56
|
+
};
|
|
57
|
+
var BEDROCK_DOCUMENT_MIME_TYPES = {
|
|
58
|
+
"application/pdf": "pdf",
|
|
59
|
+
"text/csv": "csv",
|
|
60
|
+
"application/msword": "doc",
|
|
61
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "docx",
|
|
62
|
+
"application/vnd.ms-excel": "xls",
|
|
63
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "xlsx",
|
|
64
|
+
"text/html": "html",
|
|
65
|
+
"text/plain": "txt",
|
|
66
|
+
"text/markdown": "md"
|
|
67
|
+
};
|
|
51
68
|
|
|
52
69
|
// src/bedrock-chat-options.ts
|
|
53
|
-
var
|
|
54
|
-
var bedrockProviderOptions =
|
|
70
|
+
var import_v4 = require("zod/v4");
|
|
71
|
+
var bedrockProviderOptions = import_v4.z.object({
|
|
55
72
|
/**
|
|
56
73
|
* Additional inference parameters that the model supports,
|
|
57
74
|
* beyond the base set of inference parameters that Converse
|
|
58
75
|
* supports in the inferenceConfig field
|
|
59
76
|
*/
|
|
60
|
-
additionalModelRequestFields:
|
|
61
|
-
reasoningConfig:
|
|
62
|
-
type:
|
|
63
|
-
budgetTokens:
|
|
77
|
+
additionalModelRequestFields: import_v4.z.record(import_v4.z.string(), import_v4.z.any()).optional(),
|
|
78
|
+
reasoningConfig: import_v4.z.object({
|
|
79
|
+
type: import_v4.z.union([import_v4.z.literal("enabled"), import_v4.z.literal("disabled")]).optional(),
|
|
80
|
+
budgetTokens: import_v4.z.number().optional()
|
|
64
81
|
}).optional()
|
|
65
82
|
});
|
|
66
83
|
|
|
67
84
|
// src/bedrock-error.ts
|
|
68
|
-
var
|
|
69
|
-
var BedrockErrorSchema =
|
|
70
|
-
message:
|
|
71
|
-
type:
|
|
85
|
+
var import_v42 = require("zod/v4");
|
|
86
|
+
var BedrockErrorSchema = import_v42.z.object({
|
|
87
|
+
message: import_v42.z.string(),
|
|
88
|
+
type: import_v42.z.string().nullish()
|
|
72
89
|
});
|
|
73
90
|
|
|
74
91
|
// src/bedrock-event-stream-response-handler.ts
|
|
@@ -220,7 +237,6 @@ function getCachePoint(providerMetadata) {
|
|
|
220
237
|
return (_a = providerMetadata == null ? void 0 : providerMetadata.bedrock) == null ? void 0 : _a.cachePoint;
|
|
221
238
|
}
|
|
222
239
|
async function convertToBedrockChatMessages(prompt) {
|
|
223
|
-
var _a, _b, _c, _d;
|
|
224
240
|
const blocks = groupIntoBlocks(prompt);
|
|
225
241
|
let system = [];
|
|
226
242
|
const messages = [];
|
|
@@ -267,19 +283,22 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
267
283
|
});
|
|
268
284
|
}
|
|
269
285
|
if (part.mediaType.startsWith("image/")) {
|
|
270
|
-
const bedrockImageFormat = part.mediaType === "image/*" ? void 0 : (_b = (_a = part.mediaType) == null ? void 0 : _a.split("/")) == null ? void 0 : _b[1];
|
|
271
286
|
bedrockContent.push({
|
|
272
287
|
image: {
|
|
273
|
-
format:
|
|
288
|
+
format: getBedrockImageFormat(part.mediaType),
|
|
274
289
|
source: { bytes: (0, import_provider_utils2.convertToBase64)(part.data) }
|
|
275
290
|
}
|
|
276
291
|
});
|
|
277
292
|
} else {
|
|
293
|
+
if (!part.mediaType) {
|
|
294
|
+
throw new import_provider3.UnsupportedFunctionalityError({
|
|
295
|
+
functionality: "file without mime type",
|
|
296
|
+
message: "File mime type is required in user message part content"
|
|
297
|
+
});
|
|
298
|
+
}
|
|
278
299
|
bedrockContent.push({
|
|
279
300
|
document: {
|
|
280
|
-
format: (
|
|
281
|
-
"/"
|
|
282
|
-
)) == null ? void 0 : _d[1],
|
|
301
|
+
format: getBedrockDocumentFormat(part.mediaType),
|
|
283
302
|
name: generateDocumentName(),
|
|
284
303
|
source: { bytes: (0, import_provider_utils2.convertToBase64)(part.data) }
|
|
285
304
|
}
|
|
@@ -307,12 +326,9 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
307
326
|
functionality: `media type: ${contentPart.mediaType}`
|
|
308
327
|
});
|
|
309
328
|
}
|
|
310
|
-
const format =
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
functionality: `media type: ${contentPart.mediaType}`
|
|
314
|
-
});
|
|
315
|
-
}
|
|
329
|
+
const format = getBedrockImageFormat(
|
|
330
|
+
contentPart.mediaType
|
|
331
|
+
);
|
|
316
332
|
return {
|
|
317
333
|
image: {
|
|
318
334
|
format,
|
|
@@ -445,8 +461,31 @@ async function convertToBedrockChatMessages(prompt) {
|
|
|
445
461
|
}
|
|
446
462
|
return { system, messages };
|
|
447
463
|
}
|
|
448
|
-
function
|
|
449
|
-
|
|
464
|
+
function getBedrockImageFormat(mimeType) {
|
|
465
|
+
if (!mimeType) {
|
|
466
|
+
throw new import_provider3.UnsupportedFunctionalityError({
|
|
467
|
+
functionality: "image without mime type",
|
|
468
|
+
message: "Image mime type is required in user message part content"
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
const format = BEDROCK_IMAGE_MIME_TYPES[mimeType];
|
|
472
|
+
if (!format) {
|
|
473
|
+
throw new import_provider3.UnsupportedFunctionalityError({
|
|
474
|
+
functionality: `image mime type: ${mimeType}`,
|
|
475
|
+
message: `Unsupported image mime type: ${mimeType}, expected one of: ${Object.keys(BEDROCK_IMAGE_MIME_TYPES).join(", ")}`
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
return format;
|
|
479
|
+
}
|
|
480
|
+
function getBedrockDocumentFormat(mimeType) {
|
|
481
|
+
const format = BEDROCK_DOCUMENT_MIME_TYPES[mimeType];
|
|
482
|
+
if (!format) {
|
|
483
|
+
throw new import_provider3.UnsupportedFunctionalityError({
|
|
484
|
+
functionality: `file mime type: ${mimeType}`,
|
|
485
|
+
message: `Unsupported file mime type: ${mimeType}, expected one of: ${Object.keys(BEDROCK_DOCUMENT_MIME_TYPES).join(", ")}`
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
return format;
|
|
450
489
|
}
|
|
451
490
|
function trimIfLast(isLastBlock, isLastMessage, isLastContentPart, text) {
|
|
452
491
|
return isLastBlock && isLastMessage && isLastContentPart ? text.trim() : text;
|
|
@@ -958,104 +997,104 @@ var BedrockChatLanguageModel = class {
|
|
|
958
997
|
return `${this.config.baseUrl()}/model/${encodedModelId}`;
|
|
959
998
|
}
|
|
960
999
|
};
|
|
961
|
-
var BedrockStopReasonSchema =
|
|
962
|
-
|
|
963
|
-
|
|
1000
|
+
var BedrockStopReasonSchema = import_v43.z.union([
|
|
1001
|
+
import_v43.z.enum(BEDROCK_STOP_REASONS),
|
|
1002
|
+
import_v43.z.string()
|
|
964
1003
|
]);
|
|
965
|
-
var BedrockToolUseSchema =
|
|
966
|
-
toolUseId:
|
|
967
|
-
name:
|
|
968
|
-
input:
|
|
1004
|
+
var BedrockToolUseSchema = import_v43.z.object({
|
|
1005
|
+
toolUseId: import_v43.z.string(),
|
|
1006
|
+
name: import_v43.z.string(),
|
|
1007
|
+
input: import_v43.z.unknown()
|
|
969
1008
|
});
|
|
970
|
-
var BedrockReasoningTextSchema =
|
|
971
|
-
signature:
|
|
972
|
-
text:
|
|
1009
|
+
var BedrockReasoningTextSchema = import_v43.z.object({
|
|
1010
|
+
signature: import_v43.z.string().nullish(),
|
|
1011
|
+
text: import_v43.z.string()
|
|
973
1012
|
});
|
|
974
|
-
var BedrockRedactedReasoningSchema =
|
|
975
|
-
data:
|
|
1013
|
+
var BedrockRedactedReasoningSchema = import_v43.z.object({
|
|
1014
|
+
data: import_v43.z.string()
|
|
976
1015
|
});
|
|
977
|
-
var BedrockResponseSchema =
|
|
978
|
-
metrics:
|
|
979
|
-
latencyMs:
|
|
1016
|
+
var BedrockResponseSchema = import_v43.z.object({
|
|
1017
|
+
metrics: import_v43.z.object({
|
|
1018
|
+
latencyMs: import_v43.z.number()
|
|
980
1019
|
}).nullish(),
|
|
981
|
-
output:
|
|
982
|
-
message:
|
|
983
|
-
content:
|
|
984
|
-
|
|
985
|
-
text:
|
|
1020
|
+
output: import_v43.z.object({
|
|
1021
|
+
message: import_v43.z.object({
|
|
1022
|
+
content: import_v43.z.array(
|
|
1023
|
+
import_v43.z.object({
|
|
1024
|
+
text: import_v43.z.string().nullish(),
|
|
986
1025
|
toolUse: BedrockToolUseSchema.nullish(),
|
|
987
|
-
reasoningContent:
|
|
988
|
-
|
|
1026
|
+
reasoningContent: import_v43.z.union([
|
|
1027
|
+
import_v43.z.object({
|
|
989
1028
|
reasoningText: BedrockReasoningTextSchema
|
|
990
1029
|
}),
|
|
991
|
-
|
|
1030
|
+
import_v43.z.object({
|
|
992
1031
|
redactedReasoning: BedrockRedactedReasoningSchema
|
|
993
1032
|
})
|
|
994
1033
|
]).nullish()
|
|
995
1034
|
})
|
|
996
1035
|
),
|
|
997
|
-
role:
|
|
1036
|
+
role: import_v43.z.string()
|
|
998
1037
|
})
|
|
999
1038
|
}),
|
|
1000
1039
|
stopReason: BedrockStopReasonSchema,
|
|
1001
|
-
trace:
|
|
1002
|
-
usage:
|
|
1003
|
-
inputTokens:
|
|
1004
|
-
outputTokens:
|
|
1005
|
-
totalTokens:
|
|
1006
|
-
cacheReadInputTokens:
|
|
1007
|
-
cacheWriteInputTokens:
|
|
1040
|
+
trace: import_v43.z.unknown().nullish(),
|
|
1041
|
+
usage: import_v43.z.object({
|
|
1042
|
+
inputTokens: import_v43.z.number(),
|
|
1043
|
+
outputTokens: import_v43.z.number(),
|
|
1044
|
+
totalTokens: import_v43.z.number(),
|
|
1045
|
+
cacheReadInputTokens: import_v43.z.number().nullish(),
|
|
1046
|
+
cacheWriteInputTokens: import_v43.z.number().nullish()
|
|
1008
1047
|
})
|
|
1009
1048
|
});
|
|
1010
|
-
var BedrockStreamSchema =
|
|
1011
|
-
contentBlockDelta:
|
|
1012
|
-
contentBlockIndex:
|
|
1013
|
-
delta:
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
reasoningContent:
|
|
1049
|
+
var BedrockStreamSchema = import_v43.z.object({
|
|
1050
|
+
contentBlockDelta: import_v43.z.object({
|
|
1051
|
+
contentBlockIndex: import_v43.z.number(),
|
|
1052
|
+
delta: import_v43.z.union([
|
|
1053
|
+
import_v43.z.object({ text: import_v43.z.string() }),
|
|
1054
|
+
import_v43.z.object({ toolUse: import_v43.z.object({ input: import_v43.z.string() }) }),
|
|
1055
|
+
import_v43.z.object({
|
|
1056
|
+
reasoningContent: import_v43.z.object({ text: import_v43.z.string() })
|
|
1018
1057
|
}),
|
|
1019
|
-
|
|
1020
|
-
reasoningContent:
|
|
1021
|
-
signature:
|
|
1058
|
+
import_v43.z.object({
|
|
1059
|
+
reasoningContent: import_v43.z.object({
|
|
1060
|
+
signature: import_v43.z.string()
|
|
1022
1061
|
})
|
|
1023
1062
|
}),
|
|
1024
|
-
|
|
1025
|
-
reasoningContent:
|
|
1063
|
+
import_v43.z.object({
|
|
1064
|
+
reasoningContent: import_v43.z.object({ data: import_v43.z.string() })
|
|
1026
1065
|
})
|
|
1027
1066
|
]).nullish()
|
|
1028
1067
|
}).nullish(),
|
|
1029
|
-
contentBlockStart:
|
|
1030
|
-
contentBlockIndex:
|
|
1031
|
-
start:
|
|
1068
|
+
contentBlockStart: import_v43.z.object({
|
|
1069
|
+
contentBlockIndex: import_v43.z.number(),
|
|
1070
|
+
start: import_v43.z.object({
|
|
1032
1071
|
toolUse: BedrockToolUseSchema.nullish()
|
|
1033
1072
|
}).nullish()
|
|
1034
1073
|
}).nullish(),
|
|
1035
|
-
contentBlockStop:
|
|
1036
|
-
contentBlockIndex:
|
|
1074
|
+
contentBlockStop: import_v43.z.object({
|
|
1075
|
+
contentBlockIndex: import_v43.z.number()
|
|
1037
1076
|
}).nullish(),
|
|
1038
|
-
internalServerException:
|
|
1039
|
-
messageStop:
|
|
1040
|
-
additionalModelResponseFields:
|
|
1077
|
+
internalServerException: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
|
|
1078
|
+
messageStop: import_v43.z.object({
|
|
1079
|
+
additionalModelResponseFields: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
|
|
1041
1080
|
stopReason: BedrockStopReasonSchema
|
|
1042
1081
|
}).nullish(),
|
|
1043
|
-
metadata:
|
|
1044
|
-
trace:
|
|
1045
|
-
usage:
|
|
1046
|
-
cacheReadInputTokens:
|
|
1047
|
-
cacheWriteInputTokens:
|
|
1048
|
-
inputTokens:
|
|
1049
|
-
outputTokens:
|
|
1082
|
+
metadata: import_v43.z.object({
|
|
1083
|
+
trace: import_v43.z.unknown().nullish(),
|
|
1084
|
+
usage: import_v43.z.object({
|
|
1085
|
+
cacheReadInputTokens: import_v43.z.number().nullish(),
|
|
1086
|
+
cacheWriteInputTokens: import_v43.z.number().nullish(),
|
|
1087
|
+
inputTokens: import_v43.z.number(),
|
|
1088
|
+
outputTokens: import_v43.z.number()
|
|
1050
1089
|
}).nullish()
|
|
1051
1090
|
}).nullish(),
|
|
1052
|
-
modelStreamErrorException:
|
|
1053
|
-
throttlingException:
|
|
1054
|
-
validationException:
|
|
1091
|
+
modelStreamErrorException: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
|
|
1092
|
+
throttlingException: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish(),
|
|
1093
|
+
validationException: import_v43.z.record(import_v43.z.string(), import_v43.z.unknown()).nullish()
|
|
1055
1094
|
});
|
|
1056
|
-
var bedrockReasoningMetadataSchema =
|
|
1057
|
-
signature:
|
|
1058
|
-
redactedData:
|
|
1095
|
+
var bedrockReasoningMetadataSchema = import_v43.z.object({
|
|
1096
|
+
signature: import_v43.z.string().optional(),
|
|
1097
|
+
redactedData: import_v43.z.string().optional()
|
|
1059
1098
|
});
|
|
1060
1099
|
|
|
1061
1100
|
// src/bedrock-embedding-model.ts
|
|
@@ -1063,22 +1102,22 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
1063
1102
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
1064
1103
|
|
|
1065
1104
|
// src/bedrock-embedding-options.ts
|
|
1066
|
-
var
|
|
1067
|
-
var bedrockEmbeddingProviderOptions =
|
|
1105
|
+
var import_v44 = require("zod/v4");
|
|
1106
|
+
var bedrockEmbeddingProviderOptions = import_v44.z.object({
|
|
1068
1107
|
/**
|
|
1069
1108
|
The number of dimensions the resulting output embeddings should have (defaults to 1024).
|
|
1070
1109
|
Only supported in amazon.titan-embed-text-v2:0.
|
|
1071
1110
|
*/
|
|
1072
|
-
dimensions:
|
|
1111
|
+
dimensions: import_v44.z.union([import_v44.z.literal(1024), import_v44.z.literal(512), import_v44.z.literal(256)]).optional(),
|
|
1073
1112
|
/**
|
|
1074
1113
|
Flag indicating whether or not to normalize the output embeddings. Defaults to true
|
|
1075
1114
|
Only supported in amazon.titan-embed-text-v2:0.
|
|
1076
1115
|
*/
|
|
1077
|
-
normalize:
|
|
1116
|
+
normalize: import_v44.z.boolean().optional()
|
|
1078
1117
|
});
|
|
1079
1118
|
|
|
1080
1119
|
// src/bedrock-embedding-model.ts
|
|
1081
|
-
var
|
|
1120
|
+
var import_v45 = require("zod/v4");
|
|
1082
1121
|
var BedrockEmbeddingModel = class {
|
|
1083
1122
|
constructor(modelId, config) {
|
|
1084
1123
|
this.modelId = modelId;
|
|
@@ -1140,9 +1179,9 @@ var BedrockEmbeddingModel = class {
|
|
|
1140
1179
|
};
|
|
1141
1180
|
}
|
|
1142
1181
|
};
|
|
1143
|
-
var BedrockEmbeddingResponseSchema =
|
|
1144
|
-
embedding:
|
|
1145
|
-
inputTextTokenCount:
|
|
1182
|
+
var BedrockEmbeddingResponseSchema = import_v45.z.object({
|
|
1183
|
+
embedding: import_v45.z.array(import_v45.z.number()),
|
|
1184
|
+
inputTextTokenCount: import_v45.z.number()
|
|
1146
1185
|
});
|
|
1147
1186
|
|
|
1148
1187
|
// src/bedrock-image-model.ts
|
|
@@ -1154,7 +1193,7 @@ var modelMaxImagesPerCall = {
|
|
|
1154
1193
|
};
|
|
1155
1194
|
|
|
1156
1195
|
// src/bedrock-image-model.ts
|
|
1157
|
-
var
|
|
1196
|
+
var import_v46 = require("zod/v4");
|
|
1158
1197
|
var BedrockImageModel = class {
|
|
1159
1198
|
constructor(modelId, config) {
|
|
1160
1199
|
this.modelId = modelId;
|
|
@@ -1235,8 +1274,8 @@ var BedrockImageModel = class {
|
|
|
1235
1274
|
};
|
|
1236
1275
|
}
|
|
1237
1276
|
};
|
|
1238
|
-
var bedrockImageResponseSchema =
|
|
1239
|
-
images:
|
|
1277
|
+
var bedrockImageResponseSchema = import_v46.z.object({
|
|
1278
|
+
images: import_v46.z.array(import_v46.z.string())
|
|
1240
1279
|
});
|
|
1241
1280
|
|
|
1242
1281
|
// src/headers-utils.ts
|