@ai-sdk/amazon-bedrock 3.0.0-canary.5 → 3.0.0-canary.6

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,19 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 3.0.0-canary.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 97ea26f: chore(providers/bedrock): convert to providerOptions
8
+ - 97ea26f: chore(providers/bedrock): use camelCase for providerOptions
9
+ - Updated dependencies [411e483]
10
+ - Updated dependencies [79457bd]
11
+ - Updated dependencies [ad80501]
12
+ - Updated dependencies [1766ede]
13
+ - Updated dependencies [f10304b]
14
+ - @ai-sdk/provider@2.0.0-canary.5
15
+ - @ai-sdk/provider-utils@3.0.0-canary.6
16
+
3
17
  ## 3.0.0-canary.5
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,15 +1,39 @@
1
1
  import { ProviderV2, LanguageModelV2, EmbeddingModelV1, ImageModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { z } from 'zod';
3
4
 
4
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-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 & {});
5
- interface BedrockChatSettings {
6
+ declare const bedrockProviderOptions: z.ZodObject<{
6
7
  /**
7
- Additional inference parameters that the model supports,
8
- beyond the base set of inference parameters that Converse
9
- supports in the inferenceConfig field
10
- */
11
- additionalModelRequestFields?: Record<string, any>;
12
- }
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
+ additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
13
+ reasoningConfig: z.ZodOptional<z.ZodNullable<z.ZodObject<{
14
+ type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>>>;
15
+ budgetTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type?: "enabled" | "disabled" | null | undefined;
18
+ budgetTokens?: number | null | undefined;
19
+ }, {
20
+ type?: "enabled" | "disabled" | null | undefined;
21
+ budgetTokens?: number | null | undefined;
22
+ }>>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ additionalModelRequestFields?: Record<string, any> | undefined;
25
+ reasoningConfig?: {
26
+ type?: "enabled" | "disabled" | null | undefined;
27
+ budgetTokens?: number | null | undefined;
28
+ } | null | undefined;
29
+ }, {
30
+ additionalModelRequestFields?: Record<string, any> | undefined;
31
+ reasoningConfig?: {
32
+ type?: "enabled" | "disabled" | null | undefined;
33
+ budgetTokens?: number | null | undefined;
34
+ } | null | undefined;
35
+ }>;
36
+ type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
13
37
 
14
38
  type BedrockEmbeddingModelId = 'amazon.titan-embed-text-v1' | 'amazon.titan-embed-text-v2:0' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | (string & {});
15
39
  interface BedrockEmbeddingSettings {
@@ -84,8 +108,8 @@ interface AmazonBedrockProviderSettings {
84
108
  generateId?: () => string;
85
109
  }
86
110
  interface AmazonBedrockProvider extends ProviderV2 {
87
- (modelId: BedrockChatModelId, settings?: BedrockChatSettings): LanguageModelV2;
88
- languageModel(modelId: BedrockChatModelId, settings?: BedrockChatSettings): LanguageModelV2;
111
+ (modelId: BedrockChatModelId): LanguageModelV2;
112
+ languageModel(modelId: BedrockChatModelId): LanguageModelV2;
89
113
  embedding(modelId: BedrockEmbeddingModelId, settings?: BedrockEmbeddingSettings): EmbeddingModelV1<string>;
90
114
  image(modelId: BedrockImageModelId, settings?: BedrockImageSettings): ImageModelV1;
91
115
  imageModel(modelId: BedrockImageModelId, settings?: BedrockImageSettings): ImageModelV1;
@@ -99,4 +123,4 @@ Default Bedrock provider instance.
99
123
  */
100
124
  declare const bedrock: AmazonBedrockProvider;
101
125
 
102
- export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, bedrock, createAmazonBedrock };
126
+ export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, bedrock, createAmazonBedrock };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,39 @@
1
1
  import { ProviderV2, LanguageModelV2, EmbeddingModelV1, ImageModelV1 } from '@ai-sdk/provider';
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { z } from 'zod';
3
4
 
4
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-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 & {});
5
- interface BedrockChatSettings {
6
+ declare const bedrockProviderOptions: z.ZodObject<{
6
7
  /**
7
- Additional inference parameters that the model supports,
8
- beyond the base set of inference parameters that Converse
9
- supports in the inferenceConfig field
10
- */
11
- additionalModelRequestFields?: Record<string, any>;
12
- }
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
+ additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
13
+ reasoningConfig: z.ZodOptional<z.ZodNullable<z.ZodObject<{
14
+ type: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">]>>>;
15
+ budgetTokens: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
16
+ }, "strip", z.ZodTypeAny, {
17
+ type?: "enabled" | "disabled" | null | undefined;
18
+ budgetTokens?: number | null | undefined;
19
+ }, {
20
+ type?: "enabled" | "disabled" | null | undefined;
21
+ budgetTokens?: number | null | undefined;
22
+ }>>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ additionalModelRequestFields?: Record<string, any> | undefined;
25
+ reasoningConfig?: {
26
+ type?: "enabled" | "disabled" | null | undefined;
27
+ budgetTokens?: number | null | undefined;
28
+ } | null | undefined;
29
+ }, {
30
+ additionalModelRequestFields?: Record<string, any> | undefined;
31
+ reasoningConfig?: {
32
+ type?: "enabled" | "disabled" | null | undefined;
33
+ budgetTokens?: number | null | undefined;
34
+ } | null | undefined;
35
+ }>;
36
+ type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
13
37
 
14
38
  type BedrockEmbeddingModelId = 'amazon.titan-embed-text-v1' | 'amazon.titan-embed-text-v2:0' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | (string & {});
15
39
  interface BedrockEmbeddingSettings {
@@ -84,8 +108,8 @@ interface AmazonBedrockProviderSettings {
84
108
  generateId?: () => string;
85
109
  }
86
110
  interface AmazonBedrockProvider extends ProviderV2 {
87
- (modelId: BedrockChatModelId, settings?: BedrockChatSettings): LanguageModelV2;
88
- languageModel(modelId: BedrockChatModelId, settings?: BedrockChatSettings): LanguageModelV2;
111
+ (modelId: BedrockChatModelId): LanguageModelV2;
112
+ languageModel(modelId: BedrockChatModelId): LanguageModelV2;
89
113
  embedding(modelId: BedrockEmbeddingModelId, settings?: BedrockEmbeddingSettings): EmbeddingModelV1<string>;
90
114
  image(modelId: BedrockImageModelId, settings?: BedrockImageSettings): ImageModelV1;
91
115
  imageModel(modelId: BedrockImageModelId, settings?: BedrockImageSettings): ImageModelV1;
@@ -99,4 +123,4 @@ Default Bedrock provider instance.
99
123
  */
100
124
  declare const bedrock: AmazonBedrockProvider;
101
125
 
102
- export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, bedrock, createAmazonBedrock };
126
+ export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, bedrock, createAmazonBedrock };
package/dist/index.js CHANGED
@@ -29,9 +29,8 @@ module.exports = __toCommonJS(src_exports);
29
29
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
30
30
 
31
31
  // src/bedrock-chat-language-model.ts
32
- var import_provider4 = require("@ai-sdk/provider");
33
32
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
34
- var import_zod2 = require("zod");
33
+ var import_zod3 = require("zod");
35
34
 
36
35
  // src/bedrock-api-types.ts
37
36
  var BEDROCK_CACHE_POINT = {
@@ -50,11 +49,26 @@ var BEDROCK_STOP_REASONS = [
50
49
  "tool_use"
51
50
  ];
52
51
 
53
- // src/bedrock-error.ts
52
+ // src/bedrock-chat-options.ts
54
53
  var import_zod = require("zod");
55
- var BedrockErrorSchema = import_zod.z.object({
56
- message: import_zod.z.string(),
57
- type: import_zod.z.string().nullish()
54
+ var bedrockProviderOptions = import_zod.z.object({
55
+ /**
56
+ * Additional inference parameters that the model supports,
57
+ * beyond the base set of inference parameters that Converse
58
+ * supports in the inferenceConfig field
59
+ */
60
+ additionalModelRequestFields: import_zod.z.record(import_zod.z.any()).optional(),
61
+ reasoningConfig: import_zod.z.object({
62
+ type: import_zod.z.union([import_zod.z.literal("enabled"), import_zod.z.literal("disabled")]).nullish(),
63
+ budgetTokens: import_zod.z.number().nullish()
64
+ }).nullish()
65
+ });
66
+
67
+ // src/bedrock-error.ts
68
+ var import_zod2 = require("zod");
69
+ var BedrockErrorSchema = import_zod2.z.object({
70
+ message: import_zod2.z.string(),
71
+ type: import_zod2.z.string().nullish()
58
72
  });
59
73
 
60
74
  // src/bedrock-event-stream-response-handler.ts
@@ -256,7 +270,7 @@ function convertToBedrockChatMessages(prompt) {
256
270
  bedrockContent.push({
257
271
  image: {
258
272
  format: bedrockImageFormat,
259
- source: { bytes: part.data }
273
+ source: { bytes: (0, import_provider_utils2.convertToBase64)(part.data) }
260
274
  }
261
275
  });
262
276
  } else {
@@ -266,9 +280,7 @@ function convertToBedrockChatMessages(prompt) {
266
280
  "/"
267
281
  )) == null ? void 0 : _d[1],
268
282
  name: generateFileId(),
269
- source: {
270
- bytes: part.data
271
- }
283
+ source: { bytes: (0, import_provider_utils2.convertToBase64)(part.data) }
272
284
  }
273
285
  });
274
286
  }
@@ -485,9 +497,8 @@ function mapBedrockFinishReason(finishReason) {
485
497
 
486
498
  // src/bedrock-chat-language-model.ts
487
499
  var BedrockChatLanguageModel = class {
488
- constructor(modelId, settings, config) {
500
+ constructor(modelId, config) {
489
501
  this.modelId = modelId;
490
- this.settings = settings;
491
502
  this.config = config;
492
503
  this.specificationVersion = "v2";
493
504
  this.provider = "amazon-bedrock";
@@ -496,7 +507,7 @@ var BedrockChatLanguageModel = class {
496
507
  }
497
508
  getArgs({
498
509
  prompt,
499
- maxTokens,
510
+ maxOutputTokens,
500
511
  temperature,
501
512
  topP,
502
513
  topK,
@@ -509,7 +520,12 @@ var BedrockChatLanguageModel = class {
509
520
  toolChoice,
510
521
  providerOptions
511
522
  }) {
512
- var _a, _b, _c, _d, _e, _f, _g;
523
+ var _a, _b, _c, _d, _e;
524
+ const bedrockOptions = (_a = (0, import_provider_utils3.parseProviderOptions)({
525
+ provider: "bedrock",
526
+ providerOptions,
527
+ schema: bedrockProviderOptions
528
+ })) != null ? _a : {};
513
529
  const warnings = [];
514
530
  if (frequencyPenalty != null) {
515
531
  warnings.push({
@@ -543,34 +559,24 @@ var BedrockChatLanguageModel = class {
543
559
  });
544
560
  }
545
561
  const { system, messages } = convertToBedrockChatMessages(prompt);
546
- const reasoningConfigOptions = BedrockReasoningConfigOptionsSchema.safeParse(
547
- (_a = providerOptions == null ? void 0 : providerOptions.bedrock) == null ? void 0 : _a.reasoning_config
548
- );
549
- if (!reasoningConfigOptions.success) {
550
- throw new import_provider4.InvalidArgumentError({
551
- argument: "providerOptions.bedrock.reasoning_config",
552
- message: "invalid reasoning configuration options",
553
- cause: reasoningConfigOptions.error
554
- });
555
- }
556
- const isThinking = ((_b = reasoningConfigOptions.data) == null ? void 0 : _b.type) === "enabled";
557
- const thinkingBudget = (_e = (_c = reasoningConfigOptions.data) == null ? void 0 : _c.budgetTokens) != null ? _e : (_d = reasoningConfigOptions.data) == null ? void 0 : _d.budget_tokens;
562
+ const isThinking = ((_b = bedrockOptions.reasoningConfig) == null ? void 0 : _b.type) === "enabled";
563
+ const thinkingBudget = (_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.budgetTokens;
558
564
  const inferenceConfig = {
559
- ...maxTokens != null && { maxTokens },
565
+ ...maxOutputTokens != null && { maxOutputTokens },
560
566
  ...temperature != null && { temperature },
561
567
  ...topP != null && { topP },
562
568
  ...stopSequences != null && { stopSequences }
563
569
  };
564
570
  if (isThinking && thinkingBudget != null) {
565
- if (inferenceConfig.maxTokens != null) {
566
- inferenceConfig.maxTokens += thinkingBudget;
571
+ if (inferenceConfig.maxOutputTokens != null) {
572
+ inferenceConfig.maxOutputTokens += thinkingBudget;
567
573
  } else {
568
- inferenceConfig.maxTokens = thinkingBudget + 4096;
574
+ inferenceConfig.maxOutputTokens = thinkingBudget + 4096;
569
575
  }
570
- this.settings.additionalModelRequestFields = {
571
- ...this.settings.additionalModelRequestFields,
572
- reasoning_config: {
573
- type: (_f = reasoningConfigOptions.data) == null ? void 0 : _f.type,
576
+ bedrockOptions.additionalModelRequestFields = {
577
+ ...bedrockOptions.additionalModelRequestFields,
578
+ reasoningConfig: {
579
+ type: (_d = bedrockOptions.reasoningConfig) == null ? void 0 : _d.type,
574
580
  budget_tokens: thinkingBudget
575
581
  }
576
582
  };
@@ -596,18 +602,18 @@ var BedrockChatLanguageModel = class {
596
602
  command: {
597
603
  system,
598
604
  messages,
599
- additionalModelRequestFields: this.settings.additionalModelRequestFields,
605
+ additionalModelRequestFields: bedrockOptions.additionalModelRequestFields,
600
606
  ...Object.keys(inferenceConfig).length > 0 && {
601
607
  inferenceConfig
602
608
  },
603
609
  ...providerOptions == null ? void 0 : providerOptions.bedrock,
604
- ...((_g = toolConfig.tools) == null ? void 0 : _g.length) ? { toolConfig } : {}
610
+ ...((_e = toolConfig.tools) == null ? void 0 : _e.length) ? { toolConfig } : {}
605
611
  },
606
612
  warnings: [...warnings, ...toolWarnings]
607
613
  };
608
614
  }
609
615
  async doGenerate(options) {
610
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
616
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
611
617
  const { command: args, warnings } = this.getArgs(options);
612
618
  const url = `${this.getUrl(this.modelId)}/converse`;
613
619
  const { value: response, responseHeaders } = await (0, import_provider_utils3.postJsonToApi)({
@@ -678,8 +684,8 @@ var BedrockChatLanguageModel = class {
678
684
  response.stopReason
679
685
  ),
680
686
  usage: {
681
- promptTokens: (_n = (_m = response.usage) == null ? void 0 : _m.inputTokens) != null ? _n : Number.NaN,
682
- completionTokens: (_p = (_o = response.usage) == null ? void 0 : _o.outputTokens) != null ? _p : Number.NaN
687
+ inputTokens: (_m = response.usage) == null ? void 0 : _m.inputTokens,
688
+ outputTokens: (_n = response.usage) == null ? void 0 : _n.outputTokens
683
689
  },
684
690
  response: {
685
691
  // TODO add id, timestamp, etc
@@ -709,9 +715,9 @@ var BedrockChatLanguageModel = class {
709
715
  fetch: this.config.fetch
710
716
  });
711
717
  let finishReason = "unknown";
712
- let usage = {
713
- promptTokens: Number.NaN,
714
- completionTokens: Number.NaN
718
+ const usage = {
719
+ inputTokens: void 0,
720
+ outputTokens: void 0
715
721
  };
716
722
  let providerMetadata = void 0;
717
723
  const toolCallContentBlocks = {};
@@ -751,10 +757,8 @@ var BedrockChatLanguageModel = class {
751
757
  );
752
758
  }
753
759
  if (value.metadata) {
754
- usage = {
755
- promptTokens: (_b = (_a = value.metadata.usage) == null ? void 0 : _a.inputTokens) != null ? _b : Number.NaN,
756
- completionTokens: (_d = (_c = value.metadata.usage) == null ? void 0 : _c.outputTokens) != null ? _d : Number.NaN
757
- };
760
+ usage.inputTokens = (_b = (_a = value.metadata.usage) == null ? void 0 : _a.inputTokens) != null ? _b : usage.inputTokens;
761
+ usage.outputTokens = (_d = (_c = value.metadata.usage) == null ? void 0 : _c.outputTokens) != null ? _d : usage.outputTokens;
758
762
  const cacheUsage = ((_e = value.metadata.usage) == null ? void 0 : _e.cacheReadInputTokens) != null || ((_f = value.metadata.usage) == null ? void 0 : _f.cacheWriteInputTokens) != null ? {
759
763
  usage: {
760
764
  cacheReadInputTokens: (_h = (_g = value.metadata.usage) == null ? void 0 : _g.cacheReadInputTokens) != null ? _h : Number.NaN,
@@ -855,110 +859,105 @@ var BedrockChatLanguageModel = class {
855
859
  return `${this.config.baseUrl()}/model/${encodedModelId}`;
856
860
  }
857
861
  };
858
- var BedrockReasoningConfigOptionsSchema = import_zod2.z.object({
859
- type: import_zod2.z.union([import_zod2.z.literal("enabled"), import_zod2.z.literal("disabled")]).nullish(),
860
- budget_tokens: import_zod2.z.number().nullish(),
861
- budgetTokens: import_zod2.z.number().nullish()
862
- }).nullish();
863
- var BedrockStopReasonSchema = import_zod2.z.union([
864
- import_zod2.z.enum(BEDROCK_STOP_REASONS),
865
- import_zod2.z.string()
862
+ var BedrockStopReasonSchema = import_zod3.z.union([
863
+ import_zod3.z.enum(BEDROCK_STOP_REASONS),
864
+ import_zod3.z.string()
866
865
  ]);
867
- var BedrockToolUseSchema = import_zod2.z.object({
868
- toolUseId: import_zod2.z.string(),
869
- name: import_zod2.z.string(),
870
- input: import_zod2.z.unknown()
866
+ var BedrockToolUseSchema = import_zod3.z.object({
867
+ toolUseId: import_zod3.z.string(),
868
+ name: import_zod3.z.string(),
869
+ input: import_zod3.z.unknown()
871
870
  });
872
- var BedrockReasoningTextSchema = import_zod2.z.object({
873
- signature: import_zod2.z.string().nullish(),
874
- text: import_zod2.z.string()
871
+ var BedrockReasoningTextSchema = import_zod3.z.object({
872
+ signature: import_zod3.z.string().nullish(),
873
+ text: import_zod3.z.string()
875
874
  });
876
- var BedrockRedactedReasoningSchema = import_zod2.z.object({
877
- data: import_zod2.z.string()
875
+ var BedrockRedactedReasoningSchema = import_zod3.z.object({
876
+ data: import_zod3.z.string()
878
877
  });
879
- var BedrockResponseSchema = import_zod2.z.object({
880
- metrics: import_zod2.z.object({
881
- latencyMs: import_zod2.z.number()
878
+ var BedrockResponseSchema = import_zod3.z.object({
879
+ metrics: import_zod3.z.object({
880
+ latencyMs: import_zod3.z.number()
882
881
  }).nullish(),
883
- output: import_zod2.z.object({
884
- message: import_zod2.z.object({
885
- content: import_zod2.z.array(
886
- import_zod2.z.object({
887
- text: import_zod2.z.string().nullish(),
882
+ output: import_zod3.z.object({
883
+ message: import_zod3.z.object({
884
+ content: import_zod3.z.array(
885
+ import_zod3.z.object({
886
+ text: import_zod3.z.string().nullish(),
888
887
  toolUse: BedrockToolUseSchema.nullish(),
889
- reasoningContent: import_zod2.z.union([
890
- import_zod2.z.object({
888
+ reasoningContent: import_zod3.z.union([
889
+ import_zod3.z.object({
891
890
  reasoningText: BedrockReasoningTextSchema
892
891
  }),
893
- import_zod2.z.object({
892
+ import_zod3.z.object({
894
893
  redactedReasoning: BedrockRedactedReasoningSchema
895
894
  })
896
895
  ]).nullish()
897
896
  })
898
897
  ),
899
- role: import_zod2.z.string()
898
+ role: import_zod3.z.string()
900
899
  })
901
900
  }),
902
901
  stopReason: BedrockStopReasonSchema,
903
- trace: import_zod2.z.unknown().nullish(),
904
- usage: import_zod2.z.object({
905
- inputTokens: import_zod2.z.number(),
906
- outputTokens: import_zod2.z.number(),
907
- totalTokens: import_zod2.z.number(),
908
- cacheReadInputTokens: import_zod2.z.number().nullish(),
909
- cacheWriteInputTokens: import_zod2.z.number().nullish()
902
+ trace: import_zod3.z.unknown().nullish(),
903
+ usage: import_zod3.z.object({
904
+ inputTokens: import_zod3.z.number(),
905
+ outputTokens: import_zod3.z.number(),
906
+ totalTokens: import_zod3.z.number(),
907
+ cacheReadInputTokens: import_zod3.z.number().nullish(),
908
+ cacheWriteInputTokens: import_zod3.z.number().nullish()
910
909
  })
911
910
  });
912
- var BedrockStreamSchema = import_zod2.z.object({
913
- contentBlockDelta: import_zod2.z.object({
914
- contentBlockIndex: import_zod2.z.number(),
915
- delta: import_zod2.z.union([
916
- import_zod2.z.object({ text: import_zod2.z.string() }),
917
- import_zod2.z.object({ toolUse: import_zod2.z.object({ input: import_zod2.z.string() }) }),
918
- import_zod2.z.object({
919
- reasoningContent: import_zod2.z.object({ text: import_zod2.z.string() })
911
+ var BedrockStreamSchema = import_zod3.z.object({
912
+ contentBlockDelta: import_zod3.z.object({
913
+ contentBlockIndex: import_zod3.z.number(),
914
+ delta: import_zod3.z.union([
915
+ import_zod3.z.object({ text: import_zod3.z.string() }),
916
+ import_zod3.z.object({ toolUse: import_zod3.z.object({ input: import_zod3.z.string() }) }),
917
+ import_zod3.z.object({
918
+ reasoningContent: import_zod3.z.object({ text: import_zod3.z.string() })
920
919
  }),
921
- import_zod2.z.object({
922
- reasoningContent: import_zod2.z.object({
923
- signature: import_zod2.z.string()
920
+ import_zod3.z.object({
921
+ reasoningContent: import_zod3.z.object({
922
+ signature: import_zod3.z.string()
924
923
  })
925
924
  }),
926
- import_zod2.z.object({
927
- reasoningContent: import_zod2.z.object({ data: import_zod2.z.string() })
925
+ import_zod3.z.object({
926
+ reasoningContent: import_zod3.z.object({ data: import_zod3.z.string() })
928
927
  })
929
928
  ]).nullish()
930
929
  }).nullish(),
931
- contentBlockStart: import_zod2.z.object({
932
- contentBlockIndex: import_zod2.z.number(),
933
- start: import_zod2.z.object({
930
+ contentBlockStart: import_zod3.z.object({
931
+ contentBlockIndex: import_zod3.z.number(),
932
+ start: import_zod3.z.object({
934
933
  toolUse: BedrockToolUseSchema.nullish()
935
934
  }).nullish()
936
935
  }).nullish(),
937
- contentBlockStop: import_zod2.z.object({
938
- contentBlockIndex: import_zod2.z.number()
936
+ contentBlockStop: import_zod3.z.object({
937
+ contentBlockIndex: import_zod3.z.number()
939
938
  }).nullish(),
940
- internalServerException: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
941
- messageStop: import_zod2.z.object({
942
- additionalModelResponseFields: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
939
+ internalServerException: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
940
+ messageStop: import_zod3.z.object({
941
+ additionalModelResponseFields: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
943
942
  stopReason: BedrockStopReasonSchema
944
943
  }).nullish(),
945
- metadata: import_zod2.z.object({
946
- trace: import_zod2.z.unknown().nullish(),
947
- usage: import_zod2.z.object({
948
- cacheReadInputTokens: import_zod2.z.number().nullish(),
949
- cacheWriteInputTokens: import_zod2.z.number().nullish(),
950
- inputTokens: import_zod2.z.number(),
951
- outputTokens: import_zod2.z.number()
944
+ metadata: import_zod3.z.object({
945
+ trace: import_zod3.z.unknown().nullish(),
946
+ usage: import_zod3.z.object({
947
+ cacheReadInputTokens: import_zod3.z.number().nullish(),
948
+ cacheWriteInputTokens: import_zod3.z.number().nullish(),
949
+ inputTokens: import_zod3.z.number(),
950
+ outputTokens: import_zod3.z.number()
952
951
  }).nullish()
953
952
  }).nullish(),
954
- modelStreamErrorException: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
955
- throttlingException: import_zod2.z.record(import_zod2.z.unknown()).nullish(),
956
- validationException: import_zod2.z.record(import_zod2.z.unknown()).nullish()
953
+ modelStreamErrorException: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
954
+ throttlingException: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
955
+ validationException: import_zod3.z.record(import_zod3.z.unknown()).nullish()
957
956
  });
958
957
 
959
958
  // src/bedrock-embedding-model.ts
960
959
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
961
- var import_zod3 = require("zod");
960
+ var import_zod4 = require("zod");
962
961
  var BedrockEmbeddingModel = class {
963
962
  constructor(modelId, settings, config) {
964
963
  this.modelId = modelId;
@@ -1017,9 +1016,9 @@ var BedrockEmbeddingModel = class {
1017
1016
  );
1018
1017
  }
1019
1018
  };
1020
- var BedrockEmbeddingResponseSchema = import_zod3.z.object({
1021
- embedding: import_zod3.z.array(import_zod3.z.number()),
1022
- inputTextTokenCount: import_zod3.z.number()
1019
+ var BedrockEmbeddingResponseSchema = import_zod4.z.object({
1020
+ embedding: import_zod4.z.array(import_zod4.z.number()),
1021
+ inputTextTokenCount: import_zod4.z.number()
1023
1022
  });
1024
1023
 
1025
1024
  // src/bedrock-image-model.ts
@@ -1031,7 +1030,7 @@ var modelMaxImagesPerCall = {
1031
1030
  };
1032
1031
 
1033
1032
  // src/bedrock-image-model.ts
1034
- var import_zod4 = require("zod");
1033
+ var import_zod5 = require("zod");
1035
1034
  var BedrockImageModel = class {
1036
1035
  constructor(modelId, settings, config) {
1037
1036
  this.modelId = modelId;
@@ -1113,8 +1112,8 @@ var BedrockImageModel = class {
1113
1112
  };
1114
1113
  }
1115
1114
  };
1116
- var bedrockImageResponseSchema = import_zod4.z.object({
1117
- images: import_zod4.z.array(import_zod4.z.string())
1115
+ var bedrockImageResponseSchema = import_zod5.z.object({
1116
+ images: import_zod5.z.array(import_zod5.z.string())
1118
1117
  });
1119
1118
 
1120
1119
  // src/headers-utils.ts
@@ -1236,22 +1235,22 @@ function createAmazonBedrock(options = {}) {
1236
1235
  })}.amazonaws.com`
1237
1236
  )) != null ? _b : `https://bedrock-runtime.us-east-1.amazonaws.com`;
1238
1237
  };
1239
- const createChatModel = (modelId, settings = {}) => {
1238
+ const createChatModel = (modelId) => {
1240
1239
  var _a;
1241
- return new BedrockChatLanguageModel(modelId, settings, {
1240
+ return new BedrockChatLanguageModel(modelId, {
1242
1241
  baseUrl: getBaseUrl,
1243
1242
  headers: (_a = options.headers) != null ? _a : {},
1244
1243
  fetch: sigv4Fetch,
1245
1244
  generateId: import_provider_utils7.generateId
1246
1245
  });
1247
1246
  };
1248
- const provider = function(modelId, settings) {
1247
+ const provider = function(modelId) {
1249
1248
  if (new.target) {
1250
1249
  throw new Error(
1251
1250
  "The Amazon Bedrock model function cannot be called with the new keyword."
1252
1251
  );
1253
1252
  }
1254
- return createChatModel(modelId, settings);
1253
+ return createChatModel(modelId);
1255
1254
  };
1256
1255
  const createEmbeddingModel = (modelId, settings = {}) => {
1257
1256
  var _a;