@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 +15 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +24 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -14
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +5 -2
- package/dist/internal/index.d.ts +5 -2
- package/dist/internal/index.js +23 -13
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +23 -13
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "3.0.0-beta.
|
|
10
|
+
var VERSION = true ? "3.0.0-beta.56" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -380,11 +380,6 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
382
|
case "file": {
|
|
383
|
-
if (part.mediaType !== "image/png") {
|
|
384
|
-
throw new UnsupportedFunctionalityError({
|
|
385
|
-
functionality: "Only PNG images are supported in assistant messages"
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
383
|
if (part.data instanceof URL) {
|
|
389
384
|
throw new UnsupportedFunctionalityError({
|
|
390
385
|
functionality: "File data URLs in assistant messages are not supported"
|
|
@@ -394,7 +389,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
394
389
|
inlineData: {
|
|
395
390
|
mimeType: part.mediaType,
|
|
396
391
|
data: convertToBase64(part.data)
|
|
397
|
-
}
|
|
392
|
+
},
|
|
393
|
+
thoughtSignature
|
|
398
394
|
};
|
|
399
395
|
}
|
|
400
396
|
case "tool-call": {
|
|
@@ -971,7 +967,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
971
967
|
content.push({
|
|
972
968
|
type: "file",
|
|
973
969
|
data: part.inlineData.data,
|
|
974
|
-
mediaType: part.inlineData.mimeType
|
|
970
|
+
mediaType: part.inlineData.mimeType,
|
|
971
|
+
providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
|
|
975
972
|
});
|
|
976
973
|
}
|
|
977
974
|
}
|
|
@@ -1278,7 +1275,7 @@ function extractSources({
|
|
|
1278
1275
|
groundingMetadata,
|
|
1279
1276
|
generateId: generateId3
|
|
1280
1277
|
}) {
|
|
1281
|
-
var _a, _b, _c;
|
|
1278
|
+
var _a, _b, _c, _d;
|
|
1282
1279
|
if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
|
|
1283
1280
|
return void 0;
|
|
1284
1281
|
}
|
|
@@ -1294,7 +1291,8 @@ function extractSources({
|
|
|
1294
1291
|
});
|
|
1295
1292
|
} else if (chunk.retrievedContext != null) {
|
|
1296
1293
|
const uri = chunk.retrievedContext.uri;
|
|
1297
|
-
|
|
1294
|
+
const fileSearchStore = chunk.retrievedContext.fileSearchStore;
|
|
1295
|
+
if (uri && (uri.startsWith("http://") || uri.startsWith("https://"))) {
|
|
1298
1296
|
sources.push({
|
|
1299
1297
|
type: "source",
|
|
1300
1298
|
sourceType: "url",
|
|
@@ -1302,7 +1300,7 @@ function extractSources({
|
|
|
1302
1300
|
url: uri,
|
|
1303
1301
|
title: (_b = chunk.retrievedContext.title) != null ? _b : void 0
|
|
1304
1302
|
});
|
|
1305
|
-
} else {
|
|
1303
|
+
} else if (uri) {
|
|
1306
1304
|
const title = (_c = chunk.retrievedContext.title) != null ? _c : "Unknown Document";
|
|
1307
1305
|
let mediaType = "application/octet-stream";
|
|
1308
1306
|
let filename = void 0;
|
|
@@ -1332,6 +1330,16 @@ function extractSources({
|
|
|
1332
1330
|
title,
|
|
1333
1331
|
filename
|
|
1334
1332
|
});
|
|
1333
|
+
} else if (fileSearchStore) {
|
|
1334
|
+
const title = (_d = chunk.retrievedContext.title) != null ? _d : "Unknown Document";
|
|
1335
|
+
sources.push({
|
|
1336
|
+
type: "source",
|
|
1337
|
+
sourceType: "document",
|
|
1338
|
+
id: generateId3(),
|
|
1339
|
+
mediaType: "application/octet-stream",
|
|
1340
|
+
title,
|
|
1341
|
+
filename: fileSearchStore.split("/").pop()
|
|
1342
|
+
});
|
|
1335
1343
|
}
|
|
1336
1344
|
}
|
|
1337
1345
|
}
|
|
@@ -1345,9 +1353,10 @@ var getGroundingMetadataSchema = () => z5.object({
|
|
|
1345
1353
|
z5.object({
|
|
1346
1354
|
web: z5.object({ uri: z5.string(), title: z5.string().nullish() }).nullish(),
|
|
1347
1355
|
retrievedContext: z5.object({
|
|
1348
|
-
uri: z5.string(),
|
|
1356
|
+
uri: z5.string().nullish(),
|
|
1349
1357
|
title: z5.string().nullish(),
|
|
1350
|
-
text: z5.string().nullish()
|
|
1358
|
+
text: z5.string().nullish(),
|
|
1359
|
+
fileSearchStore: z5.string().nullish()
|
|
1351
1360
|
}).nullish()
|
|
1352
1361
|
})
|
|
1353
1362
|
).nullish(),
|
|
@@ -1387,7 +1396,8 @@ var getContentSchema = () => z5.object({
|
|
|
1387
1396
|
inlineData: z5.object({
|
|
1388
1397
|
mimeType: z5.string(),
|
|
1389
1398
|
data: z5.string()
|
|
1390
|
-
})
|
|
1399
|
+
}),
|
|
1400
|
+
thoughtSignature: z5.string().nullish()
|
|
1391
1401
|
}),
|
|
1392
1402
|
z5.object({
|
|
1393
1403
|
executableCode: z5.object({
|