@ai-sdk/google 4.0.0-beta.10 → 4.0.0-beta.12
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 +16 -0
- package/dist/index.js +22 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -9
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +21 -8
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +21 -8
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/convert-to-google-generative-ai-messages.ts +18 -0
- package/src/google-generative-ai-language-model.ts +16 -24
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 ? "4.0.0-beta.
|
|
10
|
+
var VERSION = true ? "4.0.0-beta.12" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -477,6 +477,21 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
477
477
|
thoughtSignature
|
|
478
478
|
};
|
|
479
479
|
}
|
|
480
|
+
case "reasoning-file": {
|
|
481
|
+
if (part.data instanceof URL) {
|
|
482
|
+
throw new UnsupportedFunctionalityError({
|
|
483
|
+
functionality: "File data URLs in assistant messages are not supported"
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
inlineData: {
|
|
488
|
+
mimeType: part.mediaType,
|
|
489
|
+
data: convertToBase64(part.data)
|
|
490
|
+
},
|
|
491
|
+
thought: true,
|
|
492
|
+
thoughtSignature
|
|
493
|
+
};
|
|
494
|
+
}
|
|
480
495
|
case "file": {
|
|
481
496
|
if (part.data instanceof URL) {
|
|
482
497
|
throw new UnsupportedFunctionalityError({
|
|
@@ -1139,13 +1154,12 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1139
1154
|
const hasThought = part.thought === true;
|
|
1140
1155
|
const hasThoughtSignature = !!part.thoughtSignature;
|
|
1141
1156
|
content.push({
|
|
1142
|
-
type: "file",
|
|
1157
|
+
type: hasThought ? "reasoning-file" : "file",
|
|
1143
1158
|
data: part.inlineData.data,
|
|
1144
1159
|
mediaType: part.inlineData.mimeType,
|
|
1145
|
-
providerMetadata:
|
|
1160
|
+
providerMetadata: hasThoughtSignature ? {
|
|
1146
1161
|
[providerOptionsName]: {
|
|
1147
|
-
|
|
1148
|
-
...hasThoughtSignature ? { thoughtSignature: part.thoughtSignature } : {}
|
|
1162
|
+
thoughtSignature: part.thoughtSignature
|
|
1149
1163
|
}
|
|
1150
1164
|
} : void 0
|
|
1151
1165
|
});
|
|
@@ -1369,14 +1383,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1369
1383
|
}
|
|
1370
1384
|
const hasThought = part.thought === true;
|
|
1371
1385
|
const hasThoughtSignature = !!part.thoughtSignature;
|
|
1372
|
-
const fileMeta =
|
|
1386
|
+
const fileMeta = hasThoughtSignature ? {
|
|
1373
1387
|
[providerOptionsName]: {
|
|
1374
|
-
|
|
1375
|
-
...hasThoughtSignature ? { thoughtSignature: part.thoughtSignature } : {}
|
|
1388
|
+
thoughtSignature: part.thoughtSignature
|
|
1376
1389
|
}
|
|
1377
1390
|
} : void 0;
|
|
1378
1391
|
controller.enqueue({
|
|
1379
|
-
type: "file",
|
|
1392
|
+
type: hasThought ? "reasoning-file" : "file",
|
|
1380
1393
|
mediaType: part.inlineData.mimeType,
|
|
1381
1394
|
data: part.inlineData.data,
|
|
1382
1395
|
providerMetadata: fileMeta
|