@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 2.0.51
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cbc2dba: fix(provider/google): preserve nested empty object schemas and descriptions in tool parameters
|
|
8
|
+
|
|
9
|
+
## 2.0.50
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7c30c1d: fix(provider/google): preserve nested empty object schemas in tool parameters to fix "property is not defined" validation errors when using required properties with empty object types
|
|
14
|
+
|
|
3
15
|
## 2.0.49
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "2.0.
|
|
33
|
+
var VERSION = true ? "2.0.51" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -206,10 +206,19 @@ var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
|
206
206
|
var import_v45 = require("zod/v4");
|
|
207
207
|
|
|
208
208
|
// src/convert-json-schema-to-openapi-schema.ts
|
|
209
|
-
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
210
|
-
if (jsonSchema == null
|
|
209
|
+
function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
|
|
210
|
+
if (jsonSchema == null) {
|
|
211
211
|
return void 0;
|
|
212
212
|
}
|
|
213
|
+
if (isEmptyObjectSchema(jsonSchema)) {
|
|
214
|
+
if (isRoot) {
|
|
215
|
+
return void 0;
|
|
216
|
+
}
|
|
217
|
+
if (typeof jsonSchema === "object" && jsonSchema.description) {
|
|
218
|
+
return { type: "object", description: jsonSchema.description };
|
|
219
|
+
}
|
|
220
|
+
return { type: "object" };
|
|
221
|
+
}
|
|
213
222
|
if (typeof jsonSchema === "boolean") {
|
|
214
223
|
return { type: "boolean", properties: {} };
|
|
215
224
|
}
|
|
@@ -256,17 +265,19 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
256
265
|
if (properties != null) {
|
|
257
266
|
result.properties = Object.entries(properties).reduce(
|
|
258
267
|
(acc, [key, value]) => {
|
|
259
|
-
acc[key] = convertJSONSchemaToOpenAPISchema(value);
|
|
268
|
+
acc[key] = convertJSONSchemaToOpenAPISchema(value, false);
|
|
260
269
|
return acc;
|
|
261
270
|
},
|
|
262
271
|
{}
|
|
263
272
|
);
|
|
264
273
|
}
|
|
265
274
|
if (items) {
|
|
266
|
-
result.items = Array.isArray(items) ? items.map(convertJSONSchemaToOpenAPISchema) : convertJSONSchemaToOpenAPISchema(items);
|
|
275
|
+
result.items = Array.isArray(items) ? items.map((item) => convertJSONSchemaToOpenAPISchema(item, false)) : convertJSONSchemaToOpenAPISchema(items, false);
|
|
267
276
|
}
|
|
268
277
|
if (allOf) {
|
|
269
|
-
result.allOf = allOf.map(
|
|
278
|
+
result.allOf = allOf.map(
|
|
279
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
280
|
+
);
|
|
270
281
|
}
|
|
271
282
|
if (anyOf) {
|
|
272
283
|
if (anyOf.some(
|
|
@@ -276,21 +287,30 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
|
276
287
|
(schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
|
|
277
288
|
);
|
|
278
289
|
if (nonNullSchemas.length === 1) {
|
|
279
|
-
const converted = convertJSONSchemaToOpenAPISchema(
|
|
290
|
+
const converted = convertJSONSchemaToOpenAPISchema(
|
|
291
|
+
nonNullSchemas[0],
|
|
292
|
+
false
|
|
293
|
+
);
|
|
280
294
|
if (typeof converted === "object") {
|
|
281
295
|
result.nullable = true;
|
|
282
296
|
Object.assign(result, converted);
|
|
283
297
|
}
|
|
284
298
|
} else {
|
|
285
|
-
result.anyOf = nonNullSchemas.map(
|
|
299
|
+
result.anyOf = nonNullSchemas.map(
|
|
300
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
301
|
+
);
|
|
286
302
|
result.nullable = true;
|
|
287
303
|
}
|
|
288
304
|
} else {
|
|
289
|
-
result.anyOf = anyOf.map(
|
|
305
|
+
result.anyOf = anyOf.map(
|
|
306
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
307
|
+
);
|
|
290
308
|
}
|
|
291
309
|
}
|
|
292
310
|
if (oneOf) {
|
|
293
|
-
result.oneOf = oneOf.map(
|
|
311
|
+
result.oneOf = oneOf.map(
|
|
312
|
+
(item) => convertJSONSchemaToOpenAPISchema(item, false)
|
|
313
|
+
);
|
|
294
314
|
}
|
|
295
315
|
if (minLength !== void 0) {
|
|
296
316
|
result.minLength = minLength;
|