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

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/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)({
@@ -641,33 +647,41 @@ var BedrockChatLanguageModel = class {
641
647
  }
642
648
  }
643
649
  } : void 0;
644
- const reasoning = response.output.message.content.filter((content) => content.reasoningContent).map((content) => {
645
- var _a2;
646
- if (content.reasoningContent && "reasoningText" in content.reasoningContent) {
647
- return {
648
- type: "text",
649
- text: content.reasoningContent.reasoningText.text,
650
- ...content.reasoningContent.reasoningText.signature && {
651
- signature: content.reasoningContent.reasoningText.signature
650
+ const reasoning = [];
651
+ for (const content of response.output.message.content) {
652
+ if (content.reasoningContent) {
653
+ if ("reasoningText" in content.reasoningContent) {
654
+ reasoning.push({
655
+ type: "reasoning",
656
+ reasoningType: "text",
657
+ text: content.reasoningContent.reasoningText.text
658
+ });
659
+ if (content.reasoningContent.reasoningText.signature) {
660
+ reasoning.push({
661
+ type: "reasoning",
662
+ reasoningType: "signature",
663
+ signature: content.reasoningContent.reasoningText.signature
664
+ });
652
665
  }
653
- };
654
- } else if (content.reasoningContent && "redactedReasoning" in content.reasoningContent) {
655
- return {
656
- type: "redacted",
657
- data: (_a2 = content.reasoningContent.redactedReasoning.data) != null ? _a2 : ""
658
- };
659
- } else {
660
- return void 0;
666
+ } else if ("redactedReasoning" in content.reasoningContent) {
667
+ reasoning.push({
668
+ type: "reasoning",
669
+ reasoningType: "redacted",
670
+ data: (_e = content.reasoningContent.redactedReasoning.data) != null ? _e : ""
671
+ });
672
+ }
661
673
  }
662
- }).filter((item) => item !== void 0);
674
+ }
675
+ const text = (_h = (_g = (_f = response.output) == null ? void 0 : _f.message) == null ? void 0 : _g.content) == null ? void 0 : _h.map((part) => {
676
+ var _a2;
677
+ return (_a2 = part.text) != null ? _a2 : "";
678
+ }).join("");
663
679
  return {
664
- text: (_h = (_g = (_f = (_e = response.output) == null ? void 0 : _e.message) == null ? void 0 : _f.content) == null ? void 0 : _g.map((part) => {
665
- var _a2;
666
- return (_a2 = part.text) != null ? _a2 : "";
667
- }).join("")) != null ? _h : void 0,
680
+ text: text != null ? { type: "text", text } : void 0,
668
681
  toolCalls: (_l = (_k = (_j = (_i = response.output) == null ? void 0 : _i.message) == null ? void 0 : _j.content) == null ? void 0 : _k.filter((part) => !!part.toolUse)) == null ? void 0 : _l.map((part) => {
669
682
  var _a2, _b2, _c2, _d2, _e2, _f2;
670
683
  return {
684
+ type: "tool-call",
671
685
  toolCallType: "function",
672
686
  toolCallId: (_b2 = (_a2 = part.toolUse) == null ? void 0 : _a2.toolUseId) != null ? _b2 : this.config.generateId(),
673
687
  toolName: (_d2 = (_c2 = part.toolUse) == null ? void 0 : _c2.name) != null ? _d2 : `tool-${this.config.generateId()}`,
@@ -678,8 +692,8 @@ var BedrockChatLanguageModel = class {
678
692
  response.stopReason
679
693
  ),
680
694
  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
695
+ inputTokens: (_m = response.usage) == null ? void 0 : _m.inputTokens,
696
+ outputTokens: (_n = response.usage) == null ? void 0 : _n.outputTokens
683
697
  },
684
698
  response: {
685
699
  // TODO add id, timestamp, etc
@@ -709,9 +723,9 @@ var BedrockChatLanguageModel = class {
709
723
  fetch: this.config.fetch
710
724
  });
711
725
  let finishReason = "unknown";
712
- let usage = {
713
- promptTokens: Number.NaN,
714
- completionTokens: Number.NaN
726
+ const usage = {
727
+ inputTokens: void 0,
728
+ outputTokens: void 0
715
729
  };
716
730
  let providerMetadata = void 0;
717
731
  const toolCallContentBlocks = {};
@@ -751,10 +765,8 @@ var BedrockChatLanguageModel = class {
751
765
  );
752
766
  }
753
767
  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
- };
768
+ usage.inputTokens = (_b = (_a = value.metadata.usage) == null ? void 0 : _a.inputTokens) != null ? _b : usage.inputTokens;
769
+ usage.outputTokens = (_d = (_c = value.metadata.usage) == null ? void 0 : _c.outputTokens) != null ? _d : usage.outputTokens;
758
770
  const cacheUsage = ((_e = value.metadata.usage) == null ? void 0 : _e.cacheReadInputTokens) != null || ((_f = value.metadata.usage) == null ? void 0 : _f.cacheWriteInputTokens) != null ? {
759
771
  usage: {
760
772
  cacheReadInputTokens: (_h = (_g = value.metadata.usage) == null ? void 0 : _g.cacheReadInputTokens) != null ? _h : Number.NaN,
@@ -775,8 +787,8 @@ var BedrockChatLanguageModel = class {
775
787
  }
776
788
  if (((_k = value.contentBlockDelta) == null ? void 0 : _k.delta) && "text" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.text) {
777
789
  controller.enqueue({
778
- type: "text-delta",
779
- textDelta: value.contentBlockDelta.delta.text
790
+ type: "text",
791
+ text: value.contentBlockDelta.delta.text
780
792
  });
781
793
  }
782
794
  if (((_l = value.contentBlockDelta) == null ? void 0 : _l.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
@@ -784,16 +796,19 @@ var BedrockChatLanguageModel = class {
784
796
  if ("text" in reasoningContent && reasoningContent.text) {
785
797
  controller.enqueue({
786
798
  type: "reasoning",
787
- textDelta: reasoningContent.text
799
+ reasoningType: "text",
800
+ text: reasoningContent.text
788
801
  });
789
802
  } else if ("signature" in reasoningContent && reasoningContent.signature) {
790
803
  controller.enqueue({
791
- type: "reasoning-signature",
804
+ type: "reasoning",
805
+ reasoningType: "signature",
792
806
  signature: reasoningContent.signature
793
807
  });
794
808
  } else if ("data" in reasoningContent && reasoningContent.data) {
795
809
  controller.enqueue({
796
- type: "redacted-reasoning",
810
+ type: "reasoning",
811
+ reasoningType: "redacted",
797
812
  data: reasoningContent.data
798
813
  });
799
814
  }
@@ -855,116 +870,111 @@ var BedrockChatLanguageModel = class {
855
870
  return `${this.config.baseUrl()}/model/${encodedModelId}`;
856
871
  }
857
872
  };
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()
873
+ var BedrockStopReasonSchema = import_zod3.z.union([
874
+ import_zod3.z.enum(BEDROCK_STOP_REASONS),
875
+ import_zod3.z.string()
866
876
  ]);
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()
877
+ var BedrockToolUseSchema = import_zod3.z.object({
878
+ toolUseId: import_zod3.z.string(),
879
+ name: import_zod3.z.string(),
880
+ input: import_zod3.z.unknown()
871
881
  });
872
- var BedrockReasoningTextSchema = import_zod2.z.object({
873
- signature: import_zod2.z.string().nullish(),
874
- text: import_zod2.z.string()
882
+ var BedrockReasoningTextSchema = import_zod3.z.object({
883
+ signature: import_zod3.z.string().nullish(),
884
+ text: import_zod3.z.string()
875
885
  });
876
- var BedrockRedactedReasoningSchema = import_zod2.z.object({
877
- data: import_zod2.z.string()
886
+ var BedrockRedactedReasoningSchema = import_zod3.z.object({
887
+ data: import_zod3.z.string()
878
888
  });
879
- var BedrockResponseSchema = import_zod2.z.object({
880
- metrics: import_zod2.z.object({
881
- latencyMs: import_zod2.z.number()
889
+ var BedrockResponseSchema = import_zod3.z.object({
890
+ metrics: import_zod3.z.object({
891
+ latencyMs: import_zod3.z.number()
882
892
  }).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(),
893
+ output: import_zod3.z.object({
894
+ message: import_zod3.z.object({
895
+ content: import_zod3.z.array(
896
+ import_zod3.z.object({
897
+ text: import_zod3.z.string().nullish(),
888
898
  toolUse: BedrockToolUseSchema.nullish(),
889
- reasoningContent: import_zod2.z.union([
890
- import_zod2.z.object({
899
+ reasoningContent: import_zod3.z.union([
900
+ import_zod3.z.object({
891
901
  reasoningText: BedrockReasoningTextSchema
892
902
  }),
893
- import_zod2.z.object({
903
+ import_zod3.z.object({
894
904
  redactedReasoning: BedrockRedactedReasoningSchema
895
905
  })
896
906
  ]).nullish()
897
907
  })
898
908
  ),
899
- role: import_zod2.z.string()
909
+ role: import_zod3.z.string()
900
910
  })
901
911
  }),
902
912
  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()
913
+ trace: import_zod3.z.unknown().nullish(),
914
+ usage: import_zod3.z.object({
915
+ inputTokens: import_zod3.z.number(),
916
+ outputTokens: import_zod3.z.number(),
917
+ totalTokens: import_zod3.z.number(),
918
+ cacheReadInputTokens: import_zod3.z.number().nullish(),
919
+ cacheWriteInputTokens: import_zod3.z.number().nullish()
910
920
  })
911
921
  });
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() })
922
+ var BedrockStreamSchema = import_zod3.z.object({
923
+ contentBlockDelta: import_zod3.z.object({
924
+ contentBlockIndex: import_zod3.z.number(),
925
+ delta: import_zod3.z.union([
926
+ import_zod3.z.object({ text: import_zod3.z.string() }),
927
+ import_zod3.z.object({ toolUse: import_zod3.z.object({ input: import_zod3.z.string() }) }),
928
+ import_zod3.z.object({
929
+ reasoningContent: import_zod3.z.object({ text: import_zod3.z.string() })
920
930
  }),
921
- import_zod2.z.object({
922
- reasoningContent: import_zod2.z.object({
923
- signature: import_zod2.z.string()
931
+ import_zod3.z.object({
932
+ reasoningContent: import_zod3.z.object({
933
+ signature: import_zod3.z.string()
924
934
  })
925
935
  }),
926
- import_zod2.z.object({
927
- reasoningContent: import_zod2.z.object({ data: import_zod2.z.string() })
936
+ import_zod3.z.object({
937
+ reasoningContent: import_zod3.z.object({ data: import_zod3.z.string() })
928
938
  })
929
939
  ]).nullish()
930
940
  }).nullish(),
931
- contentBlockStart: import_zod2.z.object({
932
- contentBlockIndex: import_zod2.z.number(),
933
- start: import_zod2.z.object({
941
+ contentBlockStart: import_zod3.z.object({
942
+ contentBlockIndex: import_zod3.z.number(),
943
+ start: import_zod3.z.object({
934
944
  toolUse: BedrockToolUseSchema.nullish()
935
945
  }).nullish()
936
946
  }).nullish(),
937
- contentBlockStop: import_zod2.z.object({
938
- contentBlockIndex: import_zod2.z.number()
947
+ contentBlockStop: import_zod3.z.object({
948
+ contentBlockIndex: import_zod3.z.number()
939
949
  }).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(),
950
+ internalServerException: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
951
+ messageStop: import_zod3.z.object({
952
+ additionalModelResponseFields: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
943
953
  stopReason: BedrockStopReasonSchema
944
954
  }).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()
955
+ metadata: import_zod3.z.object({
956
+ trace: import_zod3.z.unknown().nullish(),
957
+ usage: import_zod3.z.object({
958
+ cacheReadInputTokens: import_zod3.z.number().nullish(),
959
+ cacheWriteInputTokens: import_zod3.z.number().nullish(),
960
+ inputTokens: import_zod3.z.number(),
961
+ outputTokens: import_zod3.z.number()
952
962
  }).nullish()
953
963
  }).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()
964
+ modelStreamErrorException: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
965
+ throttlingException: import_zod3.z.record(import_zod3.z.unknown()).nullish(),
966
+ validationException: import_zod3.z.record(import_zod3.z.unknown()).nullish()
957
967
  });
958
968
 
959
969
  // src/bedrock-embedding-model.ts
960
970
  var import_provider_utils4 = require("@ai-sdk/provider-utils");
961
- var import_zod3 = require("zod");
971
+ var import_zod4 = require("zod");
962
972
  var BedrockEmbeddingModel = class {
963
973
  constructor(modelId, settings, config) {
964
974
  this.modelId = modelId;
965
975
  this.settings = settings;
966
976
  this.config = config;
967
- this.specificationVersion = "v1";
977
+ this.specificationVersion = "v2";
968
978
  this.provider = "amazon-bedrock";
969
979
  this.maxEmbeddingsPerCall = void 0;
970
980
  this.supportsParallelCalls = true;
@@ -1017,9 +1027,9 @@ var BedrockEmbeddingModel = class {
1017
1027
  );
1018
1028
  }
1019
1029
  };
1020
- var BedrockEmbeddingResponseSchema = import_zod3.z.object({
1021
- embedding: import_zod3.z.array(import_zod3.z.number()),
1022
- inputTextTokenCount: import_zod3.z.number()
1030
+ var BedrockEmbeddingResponseSchema = import_zod4.z.object({
1031
+ embedding: import_zod4.z.array(import_zod4.z.number()),
1032
+ inputTextTokenCount: import_zod4.z.number()
1023
1033
  });
1024
1034
 
1025
1035
  // src/bedrock-image-model.ts
@@ -1031,7 +1041,7 @@ var modelMaxImagesPerCall = {
1031
1041
  };
1032
1042
 
1033
1043
  // src/bedrock-image-model.ts
1034
- var import_zod4 = require("zod");
1044
+ var import_zod5 = require("zod");
1035
1045
  var BedrockImageModel = class {
1036
1046
  constructor(modelId, settings, config) {
1037
1047
  this.modelId = modelId;
@@ -1113,8 +1123,8 @@ var BedrockImageModel = class {
1113
1123
  };
1114
1124
  }
1115
1125
  };
1116
- var bedrockImageResponseSchema = import_zod4.z.object({
1117
- images: import_zod4.z.array(import_zod4.z.string())
1126
+ var bedrockImageResponseSchema = import_zod5.z.object({
1127
+ images: import_zod5.z.array(import_zod5.z.string())
1118
1128
  });
1119
1129
 
1120
1130
  // src/headers-utils.ts
@@ -1236,22 +1246,22 @@ function createAmazonBedrock(options = {}) {
1236
1246
  })}.amazonaws.com`
1237
1247
  )) != null ? _b : `https://bedrock-runtime.us-east-1.amazonaws.com`;
1238
1248
  };
1239
- const createChatModel = (modelId, settings = {}) => {
1249
+ const createChatModel = (modelId) => {
1240
1250
  var _a;
1241
- return new BedrockChatLanguageModel(modelId, settings, {
1251
+ return new BedrockChatLanguageModel(modelId, {
1242
1252
  baseUrl: getBaseUrl,
1243
1253
  headers: (_a = options.headers) != null ? _a : {},
1244
1254
  fetch: sigv4Fetch,
1245
1255
  generateId: import_provider_utils7.generateId
1246
1256
  });
1247
1257
  };
1248
- const provider = function(modelId, settings) {
1258
+ const provider = function(modelId) {
1249
1259
  if (new.target) {
1250
1260
  throw new Error(
1251
1261
  "The Amazon Bedrock model function cannot be called with the new keyword."
1252
1262
  );
1253
1263
  }
1254
- return createChatModel(modelId, settings);
1264
+ return createChatModel(modelId);
1255
1265
  };
1256
1266
  const createEmbeddingModel = (modelId, settings = {}) => {
1257
1267
  var _a;