@ai-sdk/amazon-bedrock 4.0.170 → 4.0.171

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.
@@ -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.170" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.171" : "0.0.0-test";
39
39
 
40
40
  // src/bedrock-sigv4-fetch.ts
41
41
  function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
@@ -23,7 +23,7 @@ import {
23
23
  import { AwsV4Signer } from "aws4fetch";
24
24
 
25
25
  // src/version.ts
26
- var VERSION = true ? "4.0.170" : "0.0.0-test";
26
+ var VERSION = true ? "4.0.171" : "0.0.0-test";
27
27
 
28
28
  // src/bedrock-sigv4-fetch.ts
29
29
  function createSigV4FetchFunction(getCredentials, fetch, service = "bedrock") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/amazon-bedrock",
3
- "version": "4.0.170",
3
+ "version": "4.0.171",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "@smithy/util-utf8": "^4.0.0",
46
46
  "aws4fetch": "^1.0.20",
47
47
  "@ai-sdk/anthropic": "3.0.116",
48
- "@ai-sdk/openai": "3.0.107",
48
+ "@ai-sdk/openai": "3.0.108",
49
49
  "@ai-sdk/provider": "3.0.15",
50
50
  "@ai-sdk/provider-utils": "4.0.50"
51
51
  },
@@ -565,10 +565,16 @@ export class BedrockChatLanguageModel implements LanguageModelV3 {
565
565
  // map response content to content array
566
566
  for (const part of response.output.message.content) {
567
567
  // text
568
- if (part.text != null) {
568
+ const citationText = part.citationsContent?.content
569
+ ?.map(generatedContent => generatedContent.text)
570
+ .filter((text): text is string => text != null)
571
+ .join('');
572
+ const text = part.text ?? (citationText ? citationText : undefined);
573
+
574
+ if (text != null) {
569
575
  content.push({
570
576
  type: 'text',
571
- text: jsonObjectTextExtractor?.process(part.text) ?? part.text,
577
+ text: jsonObjectTextExtractor?.process(text) ?? text,
572
578
  });
573
579
  }
574
580
 
@@ -1277,6 +1283,17 @@ const BedrockResponseSchema = z.object({
1277
1283
  content: z.array(
1278
1284
  z.object({
1279
1285
  text: z.string().nullish(),
1286
+ citationsContent: z
1287
+ .object({
1288
+ content: z
1289
+ .array(
1290
+ z.object({
1291
+ text: z.string().nullish(),
1292
+ }),
1293
+ )
1294
+ .nullish(),
1295
+ })
1296
+ .nullish(),
1280
1297
  toolUse: BedrockToolUseSchema.nullish(),
1281
1298
  reasoningContent: z
1282
1299
  .union([