@ai-sdk/google 3.0.0-beta.82 → 3.0.0-beta.83
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 +27 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +26 -9
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +26 -9
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
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.83" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -251,10 +251,16 @@ function convertGoogleGenerativeAIUsage(usage) {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
// src/convert-json-schema-to-openapi-schema.ts
|
|
254
|
-
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
255
|
-
if (jsonSchema == null
|
|
254
|
+
function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
255
|
+
if (jsonSchema == null) {
|
|
256
256
|
return void 0;
|
|
257
257
|
}
|
|
258
|
+
if (isEmptyObjectSchema(jsonSchema)) {
|
|
259
|
+
if (isRoot) {
|
|
260
|
+
return void 0;
|
|
261
|
+
}
|
|
262
|
+
return { type: "object" };
|
|
263
|
+
}
|
|
258
264
|
if (typeof jsonSchema === "boolean") {
|
|
259
265
|
return { type: "boolean", properties: {} };
|
|
260
266
|
}
|
|
@@ -301,17 +307,19 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
301
307
|
if (properties != null) {
|
|
302
308
|
result.properties = Object.entries(properties).reduce(
|
|
303
309
|
(acc, [key, value]) => {
|
|
304
|
-
acc[key] = convertJSONSchemaToOpenAPISchema(value);
|
|
310
|
+
acc[key] = convertJSONSchemaToOpenAPISchema(value, false);
|
|
305
311
|
return acc;
|
|
306
312
|
},
|
|
307
313
|
{}
|
|
308
314
|
);
|
|
309
315
|
}
|
|
310
316
|
if (items) {
|
|
311
|
-
result.items = Array.isArray(items) ? items.map(convertJSONSchemaToOpenAPISchema) : convertJSONSchemaToOpenAPISchema(items);
|
|
317
|
+
result.items = Array.isArray(items) ? items.map((item) => convertJSONSchemaToOpenAPISchema(item, false)) : convertJSONSchemaToOpenAPISchema(items, false);
|
|
312
318
|
}
|
|
313
319
|
if (allOf) {
|
|
314
|
-
result.allOf = allOf.map(
|
|
320
|
+
result.allOf = allOf.map(
|
|
321
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
322
|
+
);
|
|
315
323
|
}
|
|
316
324
|
if (anyOf) {
|
|
317
325
|
if (anyOf.some(
|
|
@@ -321,21 +329,30 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
321
329
|
(schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
|
|
322
330
|
);
|
|
323
331
|
if (nonNullSchemas.length === 1) {
|
|
324
|
-
const converted = convertJSONSchemaToOpenAPISchema(
|
|
332
|
+
const converted = convertJSONSchemaToOpenAPISchema(
|
|
333
|
+
nonNullSchemas[0],
|
|
334
|
+
false
|
|
335
|
+
);
|
|
325
336
|
if (typeof converted === "object") {
|
|
326
337
|
result.nullable = true;
|
|
327
338
|
Object.assign(result, converted);
|
|
328
339
|
}
|
|
329
340
|
} else {
|
|
330
|
-
result.anyOf = nonNullSchemas.map(
|
|
341
|
+
result.anyOf = nonNullSchemas.map(
|
|
342
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
343
|
+
);
|
|
331
344
|
result.nullable = true;
|
|
332
345
|
}
|
|
333
346
|
} else {
|
|
334
|
-
result.anyOf = anyOf.map(
|
|
347
|
+
result.anyOf = anyOf.map(
|
|
348
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
349
|
+
);
|
|
335
350
|
}
|
|
336
351
|
}
|
|
337
352
|
if (oneOf) {
|
|
338
|
-
result.oneOf = oneOf.map(
|
|
353
|
+
result.oneOf = oneOf.map(
|
|
354
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
355
|
+
);
|
|
339
356
|
}
|
|
340
357
|
if (minLength !== void 0) {
|
|
341
358
|
result.minLength = minLength;
|