@ai-sdk/google 2.0.49 → 2.0.51
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.js +30 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +29 -9
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +29 -9
- 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.51" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -210,10 +210,19 @@ import {
|
|
|
210
210
|
import { z as z5 } from "zod/v4";
|
|
211
211
|
|
|
212
212
|
// src/convert-json-schema-to-openapi-schema.ts
|
|
213
|
-
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
214
|
-
if (jsonSchema == null
|
|
213
|
+
function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
214
|
+
if (jsonSchema == null) {
|
|
215
215
|
return void 0;
|
|
216
216
|
}
|
|
217
|
+
if (isEmptyObjectSchema(jsonSchema)) {
|
|
218
|
+
if (isRoot) {
|
|
219
|
+
return void 0;
|
|
220
|
+
}
|
|
221
|
+
if (typeof jsonSchema === "object" && jsonSchema.description) {
|
|
222
|
+
return { type: "object", description: jsonSchema.description };
|
|
223
|
+
}
|
|
224
|
+
return { type: "object" };
|
|
225
|
+
}
|
|
217
226
|
if (typeof jsonSchema === "boolean") {
|
|
218
227
|
return { type: "boolean", properties: {} };
|
|
219
228
|
}
|
|
@@ -260,17 +269,19 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
260
269
|
if (properties != null) {
|
|
261
270
|
result.properties = Object.entries(properties).reduce(
|
|
262
271
|
(acc, [key, value]) => {
|
|
263
|
-
acc[key] = convertJSONSchemaToOpenAPISchema(value);
|
|
272
|
+
acc[key] = convertJSONSchemaToOpenAPISchema(value, false);
|
|
264
273
|
return acc;
|
|
265
274
|
},
|
|
266
275
|
{}
|
|
267
276
|
);
|
|
268
277
|
}
|
|
269
278
|
if (items) {
|
|
270
|
-
result.items = Array.isArray(items) ? items.map(convertJSONSchemaToOpenAPISchema) : convertJSONSchemaToOpenAPISchema(items);
|
|
279
|
+
result.items = Array.isArray(items) ? items.map((item) => convertJSONSchemaToOpenAPISchema(item, false)) : convertJSONSchemaToOpenAPISchema(items, false);
|
|
271
280
|
}
|
|
272
281
|
if (allOf) {
|
|
273
|
-
result.allOf = allOf.map(
|
|
282
|
+
result.allOf = allOf.map(
|
|
283
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
284
|
+
);
|
|
274
285
|
}
|
|
275
286
|
if (anyOf) {
|
|
276
287
|
if (anyOf.some(
|
|
@@ -280,21 +291,30 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
280
291
|
(schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
|
|
281
292
|
);
|
|
282
293
|
if (nonNullSchemas.length === 1) {
|
|
283
|
-
const converted = convertJSONSchemaToOpenAPISchema(
|
|
294
|
+
const converted = convertJSONSchemaToOpenAPISchema(
|
|
295
|
+
nonNullSchemas[0],
|
|
296
|
+
false
|
|
297
|
+
);
|
|
284
298
|
if (typeof converted === "object") {
|
|
285
299
|
result.nullable = true;
|
|
286
300
|
Object.assign(result, converted);
|
|
287
301
|
}
|
|
288
302
|
} else {
|
|
289
|
-
result.anyOf = nonNullSchemas.map(
|
|
303
|
+
result.anyOf = nonNullSchemas.map(
|
|
304
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
305
|
+
);
|
|
290
306
|
result.nullable = true;
|
|
291
307
|
}
|
|
292
308
|
} else {
|
|
293
|
-
result.anyOf = anyOf.map(
|
|
309
|
+
result.anyOf = anyOf.map(
|
|
310
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
311
|
+
);
|
|
294
312
|
}
|
|
295
313
|
}
|
|
296
314
|
if (oneOf) {
|
|
297
|
-
result.oneOf = oneOf.map(
|
|
315
|
+
result.oneOf = oneOf.map(
|
|
316
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
317
|
+
);
|
|
298
318
|
}
|
|
299
319
|
if (minLength !== void 0) {
|
|
300
320
|
result.minLength = minLength;
|