@ai-sdk/google 3.0.0-beta.52 → 3.0.0-beta.54
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 +12 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -22
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +14 -21
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -21
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
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.54" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -240,14 +240,16 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
240
240
|
}
|
|
241
241
|
if (type) {
|
|
242
242
|
if (Array.isArray(type)) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
const hasNull = type.includes("null");
|
|
244
|
+
const nonNullTypes = type.filter((t) => t !== "null");
|
|
245
|
+
if (nonNullTypes.length === 0) {
|
|
246
|
+
result.type = "null";
|
|
246
247
|
} else {
|
|
247
|
-
result.
|
|
248
|
+
result.anyOf = nonNullTypes.map((t) => ({ type: t }));
|
|
249
|
+
if (hasNull) {
|
|
250
|
+
result.nullable = true;
|
|
251
|
+
}
|
|
248
252
|
}
|
|
249
|
-
} else if (type === "null") {
|
|
250
|
-
result.type = "null";
|
|
251
253
|
} else {
|
|
252
254
|
result.type = type;
|
|
253
255
|
}
|
|
@@ -726,7 +728,7 @@ function prepareTools({
|
|
|
726
728
|
}
|
|
727
729
|
if (toolChoice == null) {
|
|
728
730
|
return {
|
|
729
|
-
tools: { functionDeclarations },
|
|
731
|
+
tools: [{ functionDeclarations }],
|
|
730
732
|
toolConfig: void 0,
|
|
731
733
|
toolWarnings
|
|
732
734
|
};
|
|
@@ -735,25 +737,25 @@ function prepareTools({
|
|
|
735
737
|
switch (type) {
|
|
736
738
|
case "auto":
|
|
737
739
|
return {
|
|
738
|
-
tools: { functionDeclarations },
|
|
740
|
+
tools: [{ functionDeclarations }],
|
|
739
741
|
toolConfig: { functionCallingConfig: { mode: "AUTO" } },
|
|
740
742
|
toolWarnings
|
|
741
743
|
};
|
|
742
744
|
case "none":
|
|
743
745
|
return {
|
|
744
|
-
tools: { functionDeclarations },
|
|
746
|
+
tools: [{ functionDeclarations }],
|
|
745
747
|
toolConfig: { functionCallingConfig: { mode: "NONE" } },
|
|
746
748
|
toolWarnings
|
|
747
749
|
};
|
|
748
750
|
case "required":
|
|
749
751
|
return {
|
|
750
|
-
tools: { functionDeclarations },
|
|
752
|
+
tools: [{ functionDeclarations }],
|
|
751
753
|
toolConfig: { functionCallingConfig: { mode: "ANY" } },
|
|
752
754
|
toolWarnings
|
|
753
755
|
};
|
|
754
756
|
case "tool":
|
|
755
757
|
return {
|
|
756
|
-
tools: { functionDeclarations },
|
|
758
|
+
tools: [{ functionDeclarations }],
|
|
757
759
|
toolConfig: {
|
|
758
760
|
functionCallingConfig: {
|
|
759
761
|
mode: "ANY",
|
|
@@ -1170,11 +1172,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1170
1172
|
} : void 0
|
|
1171
1173
|
});
|
|
1172
1174
|
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
const inlineDataParts = getInlineDataParts(content.parts);
|
|
1176
|
-
if (inlineDataParts != null) {
|
|
1177
|
-
for (const part of inlineDataParts) {
|
|
1175
|
+
} else if ("inlineData" in part) {
|
|
1178
1176
|
controller.enqueue({
|
|
1179
1177
|
type: "file",
|
|
1180
1178
|
mediaType: part.inlineData.mimeType,
|
|
@@ -1276,11 +1274,6 @@ function getToolCallsFromParts({
|
|
|
1276
1274
|
providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
|
|
1277
1275
|
}));
|
|
1278
1276
|
}
|
|
1279
|
-
function getInlineDataParts(parts) {
|
|
1280
|
-
return parts == null ? void 0 : parts.filter(
|
|
1281
|
-
(part) => "inlineData" in part
|
|
1282
|
-
);
|
|
1283
|
-
}
|
|
1284
1277
|
function extractSources({
|
|
1285
1278
|
groundingMetadata,
|
|
1286
1279
|
generateId: generateId3
|