@ai-sdk/google 3.0.0-beta.54 → 3.0.0-beta.56

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/google
2
2
 
3
+ ## 3.0.0-beta.56
4
+
5
+ ### Patch Changes
6
+
7
+ - e300a3b: Fixed Zod validation error when using `google.tools.fileSearch()`. The Google File Search API returns `fileSearchStore` instead of `uri` in `retrievedContext`. Updated `extractSources()` function to handle both the old format (Google Search with `uri`) and new format (File Search with `fileSearchStore`), maintaining backward compatibility while preventing validation errors. Also fixed title handling to use `undefined` for URL sources and `'Unknown Document'` for document sources.
8
+
9
+ ## 3.0.0-beta.55
10
+
11
+ ### Patch Changes
12
+
13
+ - db913bd: fix(google): add thought signature to gemini 3 pro image parts
14
+ - Updated dependencies [db913bd]
15
+ - @ai-sdk/provider@3.0.0-beta.17
16
+ - @ai-sdk/provider-utils@4.0.0-beta.34
17
+
3
18
  ## 3.0.0-beta.54
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -50,6 +50,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
50
50
  mimeType: string;
51
51
  data: string;
52
52
  };
53
+ thoughtSignature?: string | null | undefined;
53
54
  } | {
54
55
  executableCode?: {
55
56
  language: string;
@@ -85,9 +86,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
85
86
  title?: string | null | undefined;
86
87
  } | null | undefined;
87
88
  retrievedContext?: {
88
- uri: string;
89
+ uri?: string | null | undefined;
89
90
  title?: string | null | undefined;
90
91
  text?: string | null | undefined;
92
+ fileSearchStore?: string | null | undefined;
91
93
  } | null | undefined;
92
94
  }[] | null | undefined;
93
95
  groundingSupports?: {
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
50
50
  mimeType: string;
51
51
  data: string;
52
52
  };
53
+ thoughtSignature?: string | null | undefined;
53
54
  } | {
54
55
  executableCode?: {
55
56
  language: string;
@@ -85,9 +86,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
85
86
  title?: string | null | undefined;
86
87
  } | null | undefined;
87
88
  retrievedContext?: {
88
- uri: string;
89
+ uri?: string | null | undefined;
89
90
  title?: string | null | undefined;
90
91
  text?: string | null | undefined;
92
+ fileSearchStore?: string | null | undefined;
91
93
  } | null | undefined;
92
94
  }[] | null | undefined;
93
95
  groundingSupports?: {
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
30
30
  var import_provider_utils13 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.0-beta.54" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.56" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -374,11 +374,6 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
374
374
  };
375
375
  }
376
376
  case "file": {
377
- if (part.mediaType !== "image/png") {
378
- throw new import_provider2.UnsupportedFunctionalityError({
379
- functionality: "Only PNG images are supported in assistant messages"
380
- });
381
- }
382
377
  if (part.data instanceof URL) {
383
378
  throw new import_provider2.UnsupportedFunctionalityError({
384
379
  functionality: "File data URLs in assistant messages are not supported"
@@ -388,7 +383,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
388
383
  inlineData: {
389
384
  mimeType: part.mediaType,
390
385
  data: (0, import_provider_utils4.convertToBase64)(part.data)
391
- }
386
+ },
387
+ thoughtSignature
392
388
  };
393
389
  }
394
390
  case "tool-call": {
@@ -963,7 +959,8 @@ var GoogleGenerativeAILanguageModel = class {
963
959
  content.push({
964
960
  type: "file",
965
961
  data: part.inlineData.data,
966
- mediaType: part.inlineData.mimeType
962
+ mediaType: part.inlineData.mimeType,
963
+ providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
967
964
  });
968
965
  }
969
966
  }
@@ -1270,7 +1267,7 @@ function extractSources({
1270
1267
  groundingMetadata,
1271
1268
  generateId: generateId3
1272
1269
  }) {
1273
- var _a, _b, _c;
1270
+ var _a, _b, _c, _d;
1274
1271
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
1275
1272
  return void 0;
1276
1273
  }
@@ -1286,7 +1283,8 @@ function extractSources({
1286
1283
  });
1287
1284
  } else if (chunk.retrievedContext != null) {
1288
1285
  const uri = chunk.retrievedContext.uri;
1289
- if (uri.startsWith("http://") || uri.startsWith("https://")) {
1286
+ const fileSearchStore = chunk.retrievedContext.fileSearchStore;
1287
+ if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
1290
1288
  sources.push({
1291
1289
  type: "source",
1292
1290
  sourceType: "url",
@@ -1294,7 +1292,7 @@ function extractSources({
1294
1292
  url: uri,
1295
1293
  title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
1296
1294
  });
1297
- } else {
1295
+ } else if (uri) {
1298
1296
  const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
1299
1297
  let mediaType = "application/octet-stream";
1300
1298
  let filename = void 0;
@@ -1324,6 +1322,16 @@ function extractSources({
1324
1322
  title,
1325
1323
  filename
1326
1324
  });
1325
+ } else if (fileSearchStore) {
1326
+ const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
1327
+ sources.push({
1328
+ type: "source",
1329
+ sourceType: "document",
1330
+ id: generateId3(),
1331
+ mediaType: "application/octet-stream",
1332
+ title,
1333
+ filename: fileSearchStore.split("/").pop()
1334
+ });
1327
1335
  }
1328
1336
  }
1329
1337
  }
@@ -1337,9 +1345,10 @@ var getGroundingMetadataSchema = () => import_v45.z.object({
1337
1345
  import_v45.z.object({
1338
1346
  web: import_v45.z.object({ uri: import_v45.z.string(), title: import_v45.z.string().nullish() }).nullish(),
1339
1347
  retrievedContext: import_v45.z.object({
1340
- uri: import_v45.z.string(),
1348
+ uri: import_v45.z.string().nullish(),
1341
1349
  title: import_v45.z.string().nullish(),
1342
- text: import_v45.z.string().nullish()
1350
+ text: import_v45.z.string().nullish(),
1351
+ fileSearchStore: import_v45.z.string().nullish()
1343
1352
  }).nullish()
1344
1353
  })
1345
1354
  ).nullish(),
@@ -1379,7 +1388,8 @@ var getContentSchema = () => import_v45.z.object({
1379
1388
  inlineData: import_v45.z.object({
1380
1389
  mimeType: import_v45.z.string(),
1381
1390
  data: import_v45.z.string()
1382
- })
1391
+ }),
1392
+ thoughtSignature: import_v45.z.string().nullish()
1383
1393
  }),
1384
1394
  import_v45.z.object({
1385
1395
  executableCode: import_v45.z.object({