@ai-sdk/google 2.0.41 → 2.0.42
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 +6 -0
- 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.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 ? "2.0.
|
|
10
|
+
var VERSION = true ? "2.0.42" : "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
|
}
|
|
@@ -729,7 +731,7 @@ function prepareTools({
|
|
|
729
731
|
}
|
|
730
732
|
if (toolChoice == null) {
|
|
731
733
|
return {
|
|
732
|
-
tools: { functionDeclarations },
|
|
734
|
+
tools: [{ functionDeclarations }],
|
|
733
735
|
toolConfig: void 0,
|
|
734
736
|
toolWarnings
|
|
735
737
|
};
|
|
@@ -738,25 +740,25 @@ function prepareTools({
|
|
|
738
740
|
switch (type) {
|
|
739
741
|
case "auto":
|
|
740
742
|
return {
|
|
741
|
-
tools: { functionDeclarations },
|
|
743
|
+
tools: [{ functionDeclarations }],
|
|
742
744
|
toolConfig: { functionCallingConfig: { mode: "AUTO" } },
|
|
743
745
|
toolWarnings
|
|
744
746
|
};
|
|
745
747
|
case "none":
|
|
746
748
|
return {
|
|
747
|
-
tools: { functionDeclarations },
|
|
749
|
+
tools: [{ functionDeclarations }],
|
|
748
750
|
toolConfig: { functionCallingConfig: { mode: "NONE" } },
|
|
749
751
|
toolWarnings
|
|
750
752
|
};
|
|
751
753
|
case "required":
|
|
752
754
|
return {
|
|
753
|
-
tools: { functionDeclarations },
|
|
755
|
+
tools: [{ functionDeclarations }],
|
|
754
756
|
toolConfig: { functionCallingConfig: { mode: "ANY" } },
|
|
755
757
|
toolWarnings
|
|
756
758
|
};
|
|
757
759
|
case "tool":
|
|
758
760
|
return {
|
|
759
|
-
tools: { functionDeclarations },
|
|
761
|
+
tools: [{ functionDeclarations }],
|
|
760
762
|
toolConfig: {
|
|
761
763
|
functionCallingConfig: {
|
|
762
764
|
mode: "ANY",
|
|
@@ -1175,11 +1177,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1175
1177
|
} : void 0
|
|
1176
1178
|
});
|
|
1177
1179
|
}
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
const inlineDataParts = getInlineDataParts(content.parts);
|
|
1181
|
-
if (inlineDataParts != null) {
|
|
1182
|
-
for (const part of inlineDataParts) {
|
|
1180
|
+
} else if ("inlineData" in part) {
|
|
1183
1181
|
controller.enqueue({
|
|
1184
1182
|
type: "file",
|
|
1185
1183
|
mediaType: part.inlineData.mimeType,
|
|
@@ -1281,11 +1279,6 @@ function getToolCallsFromParts({
|
|
|
1281
1279
|
providerMetadata: part.thoughtSignature ? { google: { thoughtSignature: part.thoughtSignature } } : void 0
|
|
1282
1280
|
}));
|
|
1283
1281
|
}
|
|
1284
|
-
function getInlineDataParts(parts) {
|
|
1285
|
-
return parts == null ? void 0 : parts.filter(
|
|
1286
|
-
(part) => "inlineData" in part
|
|
1287
|
-
);
|
|
1288
|
-
}
|
|
1289
1282
|
function extractSources({
|
|
1290
1283
|
groundingMetadata,
|
|
1291
1284
|
generateId: generateId3
|