@ai-sdk/google 3.0.0-beta.53 → 3.0.0-beta.55
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +21 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -30
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +20 -29
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +20 -29
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.55
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- db913bd: fix(google): add thought signature to gemini 3 pro image parts
|
|
8
|
+
- Updated dependencies [db913bd]
|
|
9
|
+
- @ai-sdk/provider@3.0.0-beta.17
|
|
10
|
+
- @ai-sdk/provider-utils@4.0.0-beta.34
|
|
11
|
+
|
|
12
|
+
## 3.0.0-beta.54
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- bb28cac: Change streamText loop to merge file part processing into main parts loop
|
|
17
|
+
|
|
3
18
|
## 3.0.0-beta.53
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
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.
|
|
33
|
+
var VERSION = true ? "3.0.0-beta.55" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -236,14 +236,16 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
236
236
|
}
|
|
237
237
|
if (type) {
|
|
238
238
|
if (Array.isArray(type)) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
const hasNull = type.includes("null");
|
|
240
|
+
const nonNullTypes = type.filter((t) => t !== "null");
|
|
241
|
+
if (nonNullTypes.length === 0) {
|
|
242
|
+
result.type = "null";
|
|
242
243
|
} else {
|
|
243
|
-
result.
|
|
244
|
+
result.anyOf = nonNullTypes.map((t) => ({ type: t }));
|
|
245
|
+
if (hasNull) {
|
|
246
|
+
result.nullable = true;
|
|
247
|
+
}
|
|
244
248
|
}
|
|
245
|
-
} else if (type === "null") {
|
|
246
|
-
result.type = "null";
|
|
247
249
|
} else {
|
|
248
250
|
result.type = type;
|
|
249
251
|
}
|
|
@@ -372,11 +374,6 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
372
374
|
};
|
|
373
375
|
}
|
|
374
376
|
case "file": {
|
|
375
|
-
if (part.mediaType !== "image/png") {
|
|
376
|
-
throw new import_provider2.UnsupportedFunctionalityError({
|
|
377
|
-
functionality: "Only PNG images are supported in assistant messages"
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
377
|
if (part.data instanceof URL) {
|
|
381
378
|
throw new import_provider2.UnsupportedFunctionalityError({
|
|
382
379
|
functionality: "File data URLs in assistant messages are not supported"
|
|
@@ -386,7 +383,8 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
386
383
|
inlineData: {
|
|
387
384
|
mimeType: part.mediaType,
|
|
388
385
|
data: (0, import_provider_utils4.convertToBase64)(part.data)
|
|
389
|
-
}
|
|
386
|
+
},
|
|
387
|
+
thoughtSignature
|
|
390
388
|
};
|
|
391
389
|
}
|
|
392
390
|
case "tool-call": {
|
|
@@ -718,7 +716,7 @@ function prepareTools({
|
|
|
718
716
|
}
|
|
719
717
|
if (toolChoice == null) {
|
|
720
718
|
return {
|
|
721
|
-
tools: { functionDeclarations },
|
|
719
|
+
tools: [{ functionDeclarations }],
|
|
722
720
|
toolConfig: void 0,
|
|
723
721
|
toolWarnings
|
|
724
722
|
};
|
|
@@ -727,25 +725,25 @@ function prepareTools({
|
|
|
727
725
|
switch (type) {
|
|
728
726
|
case "auto":
|
|
729
727
|
return {
|
|
730
|
-
tools: { functionDeclarations },
|
|
728
|
+
tools: [{ functionDeclarations }],
|
|
731
729
|
toolConfig: { functionCallingConfig: { mode: "AUTO" } },
|
|
732
730
|
toolWarnings
|
|
733
731
|
};
|
|
734
732
|
case "none":
|
|
735
733
|
return {
|
|
736
|
-
tools: { functionDeclarations },
|
|
734
|
+
tools: [{ functionDeclarations }],
|
|
737
735
|
toolConfig: { functionCallingConfig: { mode: "NONE" } },
|
|
738
736
|
toolWarnings
|
|
739
737
|
};
|
|
740
738
|
case "required":
|
|
741
739
|
return {
|
|
742
|
-
tools: { functionDeclarations },
|
|
740
|
+
tools: [{ functionDeclarations }],
|
|
743
741
|
toolConfig: { functionCallingConfig: { mode: "ANY" } },
|
|
744
742
|
toolWarnings
|
|
745
743
|
};
|
|
746
744
|
case "tool":
|
|
747
745
|
return {
|
|
748
|
-
tools: { functionDeclarations },
|
|
746
|
+
tools: [{ functionDeclarations }],
|
|
749
747
|
toolConfig: {
|
|
750
748
|
functionCallingConfig: {
|
|
751
749
|
mode: "ANY",
|
|
@@ -961,7 +959,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
961
959
|
content.push({
|
|
962
960
|
type: "file",
|
|
963
961
|
data: part.inlineData.data,
|
|
964
|
-
mediaType: part.inlineData.mimeType
|
|
962
|
+
mediaType: part.inlineData.mimeType,
|
|
963
|
+
providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
|
|
965
964
|
});
|
|
966
965
|
}
|
|
967
966
|
}
|
|
@@ -1162,11 +1161,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1162
1161
|
} : void 0
|
|
1163
1162
|
});
|
|
1164
1163
|
}
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
const inlineDataParts = getInlineDataParts(content.parts);
|
|
1168
|
-
if (inlineDataParts != null) {
|
|
1169
|
-
for (const part of inlineDataParts) {
|
|
1164
|
+
} else if ("inlineData" in part) {
|
|
1170
1165
|
controller.enqueue({
|
|
1171
1166
|
type: "file",
|
|
1172
1167
|
mediaType: part.inlineData.mimeType,
|
|
@@ -1268,11 +1263,6 @@ function getToolCallsFromParts({
|
|
|
1268
1263
|
providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
|
|
1269
1264
|
}));
|
|
1270
1265
|
}
|
|
1271
|
-
function getInlineDataParts(parts) {
|
|
1272
|
-
return parts == null ? void 0 : parts.filter(
|
|
1273
|
-
(part) => "inlineData" in part
|
|
1274
|
-
);
|
|
1275
|
-
}
|
|
1276
1266
|
function extractSources({
|
|
1277
1267
|
groundingMetadata,
|
|
1278
1268
|
generateId: generateId3
|
|
@@ -1386,7 +1376,8 @@ var getContentSchema = () => import_v45.z.object({
|
|
|
1386
1376
|
inlineData: import_v45.z.object({
|
|
1387
1377
|
mimeType: import_v45.z.string(),
|
|
1388
1378
|
data: import_v45.z.string()
|
|
1389
|
-
})
|
|
1379
|
+
}),
|
|
1380
|
+
thoughtSignature: import_v45.z.string().nullish()
|
|
1390
1381
|
}),
|
|
1391
1382
|
import_v45.z.object({
|
|
1392
1383
|
executableCode: import_v45.z.object({
|