@ai-sdk/amazon-bedrock 4.0.55 → 4.0.57

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,20 @@
1
1
  # @ai-sdk/amazon-bedrock
2
2
 
3
+ ## 4.0.57
4
+
5
+ ### Patch Changes
6
+
7
+ - 61d25a9: fix(provider/amazon-bedrock): extract response metadata from api headers
8
+ - 08f54fc: feat(provider/amazon-bedrock): add performanceConfig, serviceTier, and cacheDetails to provider metadata
9
+
10
+ ## 4.0.56
11
+
12
+ ### Patch Changes
13
+
14
+ - 99fbed8: feat: normalize provider specific model options type names and ensure they are exported
15
+ - Updated dependencies [99fbed8]
16
+ - @ai-sdk/anthropic@3.0.42
17
+
3
18
  ## 4.0.55
4
19
 
5
20
  ### Patch Changes
@@ -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.55" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.57" : "0.0.0-test";
39
39
 
40
40
  // src/bedrock-sigv4-fetch.ts
41
41
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
@@ -24,7 +24,7 @@ import {
24
24
  import { AwsV4Signer } from "aws4fetch";
25
25
 
26
26
  // src/version.ts
27
- var VERSION = true ? "4.0.55" : "0.0.0-test";
27
+ var VERSION = true ? "4.0.57" : "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
@@ -5,7 +5,7 @@ import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, RerankingM
5
5
  import { FetchFunction } from '@ai-sdk/provider-utils';
6
6
 
7
7
  type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-haiku-4-5-20251001-v1:0' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-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' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
8
- declare const bedrockProviderOptions: z.ZodObject<{
8
+ declare const amazonBedrockLanguageModelOptions: z.ZodObject<{
9
9
  additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
10
10
  reasoningConfig: z.ZodOptional<z.ZodObject<{
11
11
  type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">, z.ZodLiteral<"adaptive">]>>;
@@ -19,7 +19,7 @@ declare const bedrockProviderOptions: z.ZodObject<{
19
19
  }, z.core.$strip>>;
20
20
  anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
21
  }, z.core.$strip>;
22
- type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
22
+ type AmazonBedrockLanguageModelOptions = z.infer<typeof amazonBedrockLanguageModelOptions>;
23
23
 
24
24
  type BedrockEmbeddingModelId = 'amazon.titan-embed-text-v1' | 'amazon.titan-embed-text-v2:0' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | (string & {});
25
25
 
@@ -33,7 +33,7 @@ interface BedrockCredentials {
33
33
  }
34
34
 
35
35
  type BedrockRerankingModelId = 'amazon.rerank-v1:0' | 'cohere.rerank-v3-5:0' | (string & {});
36
- type BedrockRerankingOptions = {
36
+ type AmazonBedrockRerankingModelOptions = {
37
37
  /**
38
38
  * If the total number of results was greater than could fit in a response, a token is returned in the nextToken field. You can enter that token in this field to return the next batch of results.
39
39
  */
@@ -162,4 +162,4 @@ declare const bedrock: AmazonBedrockProvider;
162
162
 
163
163
  declare const VERSION: string;
164
164
 
165
- export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, type BedrockRerankingOptions, VERSION, bedrock, createAmazonBedrock };
165
+ export { type AmazonBedrockLanguageModelOptions, type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type AmazonBedrockRerankingModelOptions, type AmazonBedrockLanguageModelOptions as BedrockProviderOptions, type AmazonBedrockRerankingModelOptions as BedrockRerankingOptions, VERSION, bedrock, createAmazonBedrock };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, RerankingM
5
5
  import { FetchFunction } from '@ai-sdk/provider-utils';
6
6
 
7
7
  type BedrockChatModelId = 'amazon.titan-tg1-large' | 'amazon.titan-text-express-v1' | 'anthropic.claude-v2' | 'anthropic.claude-v2:1' | 'anthropic.claude-instant-v1' | 'anthropic.claude-haiku-4-5-20251001-v1:0' | 'anthropic.claude-sonnet-4-20250514-v1:0' | 'anthropic.claude-sonnet-4-5-20250929-v1:0' | 'anthropic.claude-opus-4-20250514-v1:0' | 'anthropic.claude-opus-4-1-20250805-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' | 'openai.gpt-oss-120b-1:0' | 'openai.gpt-oss-20b-1:0' | 'amazon.titan-text-express-v1' | 'amazon.titan-text-lite-v1' | 'us.amazon.nova-premier-v1:0' | 'us.amazon.nova-pro-v1:0' | 'us.amazon.nova-micro-v1:0' | 'us.amazon.nova-lite-v1:0' | 'us.anthropic.claude-3-sonnet-20240229-v1:0' | 'us.anthropic.claude-3-opus-20240229-v1:0' | 'us.anthropic.claude-3-haiku-20240307-v1:0' | 'us.anthropic.claude-3-5-sonnet-20240620-v1:0' | 'us.anthropic.claude-3-5-haiku-20241022-v1:0' | 'us.anthropic.claude-3-5-sonnet-20241022-v2:0' | 'us.anthropic.claude-3-7-sonnet-20250219-v1:0' | 'us.anthropic.claude-sonnet-4-20250514-v1:0' | 'us.anthropic.claude-sonnet-4-5-20250929-v1:0' | 'us.anthropic.claude-opus-4-20250514-v1:0' | 'us.anthropic.claude-opus-4-1-20250805-v1:0' | 'us.meta.llama3-2-11b-instruct-v1:0' | 'us.meta.llama3-2-3b-instruct-v1:0' | 'us.meta.llama3-2-90b-instruct-v1:0' | 'us.meta.llama3-2-1b-instruct-v1:0' | 'us.meta.llama3-1-8b-instruct-v1:0' | 'us.meta.llama3-1-70b-instruct-v1:0' | 'us.meta.llama3-3-70b-instruct-v1:0' | 'us.deepseek.r1-v1:0' | 'us.mistral.pixtral-large-2502-v1:0' | 'us.meta.llama4-scout-17b-instruct-v1:0' | 'us.meta.llama4-maverick-17b-instruct-v1:0' | (string & {});
8
- declare const bedrockProviderOptions: z.ZodObject<{
8
+ declare const amazonBedrockLanguageModelOptions: z.ZodObject<{
9
9
  additionalModelRequestFields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
10
10
  reasoningConfig: z.ZodOptional<z.ZodObject<{
11
11
  type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"enabled">, z.ZodLiteral<"disabled">, z.ZodLiteral<"adaptive">]>>;
@@ -19,7 +19,7 @@ declare const bedrockProviderOptions: z.ZodObject<{
19
19
  }, z.core.$strip>>;
20
20
  anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
21
  }, z.core.$strip>;
22
- type BedrockProviderOptions = z.infer<typeof bedrockProviderOptions>;
22
+ type AmazonBedrockLanguageModelOptions = z.infer<typeof amazonBedrockLanguageModelOptions>;
23
23
 
24
24
  type BedrockEmbeddingModelId = 'amazon.titan-embed-text-v1' | 'amazon.titan-embed-text-v2:0' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | (string & {});
25
25
 
@@ -33,7 +33,7 @@ interface BedrockCredentials {
33
33
  }
34
34
 
35
35
  type BedrockRerankingModelId = 'amazon.rerank-v1:0' | 'cohere.rerank-v3-5:0' | (string & {});
36
- type BedrockRerankingOptions = {
36
+ type AmazonBedrockRerankingModelOptions = {
37
37
  /**
38
38
  * If the total number of results was greater than could fit in a response, a token is returned in the nextToken field. You can enter that token in this field to return the next batch of results.
39
39
  */
@@ -162,4 +162,4 @@ declare const bedrock: AmazonBedrockProvider;
162
162
 
163
163
  declare const VERSION: string;
164
164
 
165
- export { type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type BedrockProviderOptions, type BedrockRerankingOptions, VERSION, bedrock, createAmazonBedrock };
165
+ export { type AmazonBedrockLanguageModelOptions, type AmazonBedrockProvider, type AmazonBedrockProviderSettings, type AmazonBedrockRerankingModelOptions, type AmazonBedrockLanguageModelOptions as BedrockProviderOptions, type AmazonBedrockRerankingModelOptions as BedrockRerankingOptions, VERSION, bedrock, createAmazonBedrock };
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ var bedrockFilePartProviderOptions = import_v4.z.object({
79
79
  enabled: import_v4.z.boolean()
80
80
  }).optional()
81
81
  });
82
- var bedrockProviderOptions = import_v4.z.object({
82
+ var amazonBedrockLanguageModelOptions = import_v4.z.object({
83
83
  /**
84
84
  * Additional inference parameters that the model supports,
85
85
  * beyond the base set of inference parameters that Converse
@@ -772,7 +772,7 @@ var BedrockChatLanguageModel = class {
772
772
  const bedrockOptions = (_a = await (0, import_provider_utils4.parseProviderOptions)({
773
773
  provider: "bedrock",
774
774
  providerOptions,
775
- schema: bedrockProviderOptions
775
+ schema: amazonBedrockLanguageModelOptions
776
776
  })) != null ? _a : {};
777
777
  const warnings = [];
778
778
  if (frequencyPenalty != null) {
@@ -1003,7 +1003,7 @@ var BedrockChatLanguageModel = class {
1003
1003
  return (0, import_provider_utils4.combineHeaders)(await (0, import_provider_utils4.resolve)(this.config.headers), headers);
1004
1004
  }
1005
1005
  async doGenerate(options) {
1006
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1006
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
1007
1007
  const {
1008
1008
  command: args,
1009
1009
  warnings,
@@ -1080,12 +1080,23 @@ var BedrockChatLanguageModel = class {
1080
1080
  }
1081
1081
  }
1082
1082
  const stopSequence = (_j = (_i = (_h = response.additionalModelResponseFields) == null ? void 0 : _h.delta) == null ? void 0 : _i.stop_sequence) != null ? _j : null;
1083
- const providerMetadata = response.trace || response.usage || isJsonResponseFromTool || stopSequence ? {
1083
+ const providerMetadata = response.trace || response.usage || response.performanceConfig || response.serviceTier || isJsonResponseFromTool || stopSequence ? {
1084
1084
  bedrock: {
1085
1085
  ...response.trace && typeof response.trace === "object" ? { trace: response.trace } : {},
1086
- ...((_k = response.usage) == null ? void 0 : _k.cacheWriteInputTokens) != null && {
1086
+ ...response.performanceConfig && {
1087
+ performanceConfig: response.performanceConfig
1088
+ },
1089
+ ...response.serviceTier && {
1090
+ serviceTier: response.serviceTier
1091
+ },
1092
+ ...(((_k = response.usage) == null ? void 0 : _k.cacheWriteInputTokens) != null || ((_l = response.usage) == null ? void 0 : _l.cacheDetails) != null) && {
1087
1093
  usage: {
1088
- cacheWriteInputTokens: response.usage.cacheWriteInputTokens
1094
+ ...response.usage.cacheWriteInputTokens != null && {
1095
+ cacheWriteInputTokens: response.usage.cacheWriteInputTokens
1096
+ },
1097
+ ...response.usage.cacheDetails != null && {
1098
+ cacheDetails: response.usage.cacheDetails
1099
+ }
1089
1100
  }
1090
1101
  },
1091
1102
  ...isJsonResponseFromTool && { isJsonResponseFromTool: true },
@@ -1099,11 +1110,13 @@ var BedrockChatLanguageModel = class {
1099
1110
  response.stopReason,
1100
1111
  isJsonResponseFromTool
1101
1112
  ),
1102
- raw: (_l = response.stopReason) != null ? _l : void 0
1113
+ raw: (_m = response.stopReason) != null ? _m : void 0
1103
1114
  },
1104
1115
  usage: convertBedrockUsage(response.usage),
1105
1116
  response: {
1106
- // TODO add id, timestamp, etc
1117
+ id: (_n = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _n : void 0,
1118
+ timestamp: (responseHeaders == null ? void 0 : responseHeaders["date"]) != null ? new Date(responseHeaders["date"]) : void 0,
1119
+ modelId: this.modelId,
1107
1120
  headers: responseHeaders
1108
1121
  },
1109
1122
  warnings,
@@ -1116,8 +1129,9 @@ var BedrockChatLanguageModel = class {
1116
1129
  warnings,
1117
1130
  usesJsonResponseTool
1118
1131
  } = await this.getArgs(options);
1119
- const isMistral = isMistralModel(this.modelId);
1120
- const url = `${this.getUrl(this.modelId)}/converse-stream`;
1132
+ const modelId = this.modelId;
1133
+ const isMistral = isMistralModel(modelId);
1134
+ const url = `${this.getUrl(modelId)}/converse-stream`;
1121
1135
  const { value: response, responseHeaders } = await (0, import_provider_utils4.postJsonToApi)({
1122
1136
  url,
1123
1137
  headers: await this.getHeaders({ headers: options.headers }),
@@ -1143,10 +1157,17 @@ var BedrockChatLanguageModel = class {
1143
1157
  stream: response.pipeThrough(
1144
1158
  new TransformStream({
1145
1159
  start(controller) {
1160
+ var _a;
1146
1161
  controller.enqueue({ type: "stream-start", warnings });
1162
+ controller.enqueue({
1163
+ type: "response-metadata",
1164
+ id: (_a = responseHeaders == null ? void 0 : responseHeaders["x-amzn-requestid"]) != null ? _a : void 0,
1165
+ timestamp: (responseHeaders == null ? void 0 : responseHeaders["date"]) != null ? new Date(responseHeaders["date"]) : void 0,
1166
+ modelId
1167
+ });
1147
1168
  },
1148
1169
  transform(chunk, controller) {
1149
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
1170
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1150
1171
  function enqueueError(bedrockError) {
1151
1172
  finishReason = { unified: "error", raw: void 0 };
1152
1173
  controller.enqueue({ type: "error", error: bedrockError });
@@ -1189,24 +1210,35 @@ var BedrockChatLanguageModel = class {
1189
1210
  if (value.metadata.usage) {
1190
1211
  usage = value.metadata.usage;
1191
1212
  }
1192
- const cacheUsage = ((_e = value.metadata.usage) == null ? void 0 : _e.cacheWriteInputTokens) != null ? {
1213
+ const cacheUsage = ((_e = value.metadata.usage) == null ? void 0 : _e.cacheWriteInputTokens) != null || ((_f = value.metadata.usage) == null ? void 0 : _f.cacheDetails) != null ? {
1193
1214
  usage: {
1194
- cacheWriteInputTokens: value.metadata.usage.cacheWriteInputTokens
1215
+ ...((_g = value.metadata.usage) == null ? void 0 : _g.cacheWriteInputTokens) != null && {
1216
+ cacheWriteInputTokens: value.metadata.usage.cacheWriteInputTokens
1217
+ },
1218
+ ...((_h = value.metadata.usage) == null ? void 0 : _h.cacheDetails) != null && {
1219
+ cacheDetails: value.metadata.usage.cacheDetails
1220
+ }
1195
1221
  }
1196
1222
  } : void 0;
1197
1223
  const trace = value.metadata.trace ? {
1198
1224
  trace: value.metadata.trace
1199
1225
  } : void 0;
1200
- if (cacheUsage || trace) {
1226
+ if (cacheUsage || trace || value.metadata.performanceConfig || value.metadata.serviceTier) {
1201
1227
  providerMetadata = {
1202
1228
  bedrock: {
1203
1229
  ...cacheUsage,
1204
- ...trace
1230
+ ...trace,
1231
+ ...value.metadata.performanceConfig && {
1232
+ performanceConfig: value.metadata.performanceConfig
1233
+ },
1234
+ ...value.metadata.serviceTier && {
1235
+ serviceTier: value.metadata.serviceTier
1236
+ }
1205
1237
  }
1206
1238
  };
1207
1239
  }
1208
1240
  }
1209
- if (((_f = value.contentBlockStart) == null ? void 0 : _f.contentBlockIndex) != null && !((_h = (_g = value.contentBlockStart) == null ? void 0 : _g.start) == null ? void 0 : _h.toolUse)) {
1241
+ if (((_i = value.contentBlockStart) == null ? void 0 : _i.contentBlockIndex) != null && !((_k = (_j = value.contentBlockStart) == null ? void 0 : _j.start) == null ? void 0 : _k.toolUse)) {
1210
1242
  const blockIndex = value.contentBlockStart.contentBlockIndex;
1211
1243
  contentBlocks[blockIndex] = { type: "text" };
1212
1244
  controller.enqueue({
@@ -1214,7 +1246,7 @@ var BedrockChatLanguageModel = class {
1214
1246
  id: String(blockIndex)
1215
1247
  });
1216
1248
  }
1217
- if (((_i = value.contentBlockDelta) == null ? void 0 : _i.delta) && "text" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.text) {
1249
+ if (((_l = value.contentBlockDelta) == null ? void 0 : _l.delta) && "text" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.text) {
1218
1250
  const blockIndex = value.contentBlockDelta.contentBlockIndex || 0;
1219
1251
  if (contentBlocks[blockIndex] == null) {
1220
1252
  contentBlocks[blockIndex] = { type: "text" };
@@ -1229,7 +1261,7 @@ var BedrockChatLanguageModel = class {
1229
1261
  delta: value.contentBlockDelta.delta.text
1230
1262
  });
1231
1263
  }
1232
- if (((_j = value.contentBlockStop) == null ? void 0 : _j.contentBlockIndex) != null) {
1264
+ if (((_m = value.contentBlockStop) == null ? void 0 : _m.contentBlockIndex) != null) {
1233
1265
  const blockIndex = value.contentBlockStop.contentBlockIndex;
1234
1266
  const contentBlock = contentBlocks[blockIndex];
1235
1267
  if (contentBlock != null) {
@@ -1275,7 +1307,7 @@ var BedrockChatLanguageModel = class {
1275
1307
  delete contentBlocks[blockIndex];
1276
1308
  }
1277
1309
  }
1278
- if (((_k = value.contentBlockDelta) == null ? void 0 : _k.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
1310
+ if (((_n = value.contentBlockDelta) == null ? void 0 : _n.delta) && "reasoningContent" in value.contentBlockDelta.delta && value.contentBlockDelta.delta.reasoningContent) {
1279
1311
  const blockIndex = value.contentBlockDelta.contentBlockIndex || 0;
1280
1312
  const reasoningContent = value.contentBlockDelta.delta.reasoningContent;
1281
1313
  if ("text" in reasoningContent && reasoningContent.text) {
@@ -1316,7 +1348,7 @@ var BedrockChatLanguageModel = class {
1316
1348
  }
1317
1349
  }
1318
1350
  const contentBlockStart = value.contentBlockStart;
1319
- if (((_l = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _l.toolUse) != null) {
1351
+ if (((_o = contentBlockStart == null ? void 0 : contentBlockStart.start) == null ? void 0 : _o.toolUse) != null) {
1320
1352
  const toolUse = contentBlockStart.start.toolUse;
1321
1353
  const blockIndex = contentBlockStart.contentBlockIndex;
1322
1354
  const isJsonResponseTool = usesJsonResponseTool && toolUse.name === "json";
@@ -1344,7 +1376,7 @@ var BedrockChatLanguageModel = class {
1344
1376
  const blockIndex = contentBlockDelta.contentBlockIndex;
1345
1377
  const contentBlock = contentBlocks[blockIndex];
1346
1378
  if ((contentBlock == null ? void 0 : contentBlock.type) === "tool-call") {
1347
- const delta = (_m = contentBlockDelta.delta.toolUse.input) != null ? _m : "";
1379
+ const delta = (_p = contentBlockDelta.delta.toolUse.input) != null ? _p : "";
1348
1380
  if (!contentBlock.isJsonResponseTool) {
1349
1381
  controller.enqueue({
1350
1382
  type: "tool-input-delta",
@@ -1442,12 +1474,15 @@ var BedrockResponseSchema = import_v43.z.object({
1442
1474
  stopReason: BedrockStopReasonSchema,
1443
1475
  additionalModelResponseFields: BedrockAdditionalModelResponseFieldsSchema.nullish(),
1444
1476
  trace: import_v43.z.unknown().nullish(),
1477
+ performanceConfig: import_v43.z.object({ latency: import_v43.z.string() }).nullish(),
1478
+ serviceTier: import_v43.z.object({ type: import_v43.z.string() }).nullish(),
1445
1479
  usage: import_v43.z.object({
1446
1480
  inputTokens: import_v43.z.number(),
1447
1481
  outputTokens: import_v43.z.number(),
1448
1482
  totalTokens: import_v43.z.number(),
1449
1483
  cacheReadInputTokens: import_v43.z.number().nullish(),
1450
- cacheWriteInputTokens: import_v43.z.number().nullish()
1484
+ cacheWriteInputTokens: import_v43.z.number().nullish(),
1485
+ cacheDetails: import_v43.z.array(import_v43.z.object({ inputTokens: import_v43.z.number(), ttl: import_v43.z.string() })).nullish()
1451
1486
  })
1452
1487
  });
1453
1488
  var BedrockStreamSchema = import_v43.z.object({
@@ -1485,9 +1520,12 @@ var BedrockStreamSchema = import_v43.z.object({
1485
1520
  }).nullish(),
1486
1521
  metadata: import_v43.z.object({
1487
1522
  trace: import_v43.z.unknown().nullish(),
1523
+ performanceConfig: import_v43.z.object({ latency: import_v43.z.string() }).nullish(),
1524
+ serviceTier: import_v43.z.object({ type: import_v43.z.string() }).nullish(),
1488
1525
  usage: import_v43.z.object({
1489
1526
  cacheReadInputTokens: import_v43.z.number().nullish(),
1490
1527
  cacheWriteInputTokens: import_v43.z.number().nullish(),
1528
+ cacheDetails: import_v43.z.array(import_v43.z.object({ inputTokens: import_v43.z.number(), ttl: import_v43.z.string() })).nullish(),
1491
1529
  inputTokens: import_v43.z.number(),
1492
1530
  outputTokens: import_v43.z.number()
1493
1531
  }).nullish()
@@ -1894,7 +1932,7 @@ var import_provider_utils7 = require("@ai-sdk/provider-utils");
1894
1932
  var import_aws4fetch = require("aws4fetch");
1895
1933
 
1896
1934
  // src/version.ts
1897
- var VERSION = true ? "4.0.55" : "0.0.0-test";
1935
+ var VERSION = true ? "4.0.57" : "0.0.0-test";
1898
1936
 
1899
1937
  // src/bedrock-sigv4-fetch.ts
1900
1938
  function createSigV4FetchFunction(getCredentials, fetch = globalThis.fetch) {
@@ -2000,7 +2038,7 @@ var bedrockRerankingResponseSchema = (0, import_provider_utils8.lazySchema)(
2000
2038
  // src/reranking/bedrock-reranking-options.ts
2001
2039
  var import_provider_utils9 = require("@ai-sdk/provider-utils");
2002
2040
  var import_v48 = require("zod/v4");
2003
- var bedrockRerankingOptionsSchema = (0, import_provider_utils9.lazySchema)(
2041
+ var amazonBedrockRerankingModelOptionsSchema = (0, import_provider_utils9.lazySchema)(
2004
2042
  () => (0, import_provider_utils9.zodSchema)(
2005
2043
  import_v48.z.object({
2006
2044
  /**
@@ -2034,7 +2072,7 @@ var BedrockRerankingModel = class {
2034
2072
  const bedrockOptions = await (0, import_provider_utils10.parseProviderOptions)({
2035
2073
  provider: "bedrock",
2036
2074
  providerOptions,
2037
- schema: bedrockRerankingOptionsSchema
2075
+ schema: amazonBedrockRerankingModelOptionsSchema
2038
2076
  });
2039
2077
  const {
2040
2078
  value: response,