@ai-sdk/google 3.0.0-beta.81 → 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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.83
4
+
5
+ ### Patch Changes
6
+
7
+ - 166b6d7: 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
8
+
9
+ ## 3.0.0-beta.82
10
+
11
+ ### Patch Changes
12
+
13
+ - 9061dc0: feat: image editing
14
+ - Updated dependencies [9061dc0]
15
+ - @ai-sdk/provider-utils@4.0.0-beta.54
16
+ - @ai-sdk/provider@3.0.0-beta.28
17
+
3
18
  ## 3.0.0-beta.81
4
19
 
5
20
  ### 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 ? "3.0.0-beta.81" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.0-beta.83" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -247,10 +247,16 @@ function convertGoogleGenerativeAIUsage(usage) {
247
247
  }
248
248
 
249
249
  // src/convert-json-schema-to-openapi-schema.ts
250
- function convertJSONSchemaToOpenAPISchema(jsonSchema) {
251
- if (jsonSchema == null || isEmptyObjectSchema(jsonSchema)) {
250
+ function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
251
+ if (jsonSchema == null) {
252
252
  return void 0;
253
253
  }
254
+ if (isEmptyObjectSchema(jsonSchema)) {
255
+ if (isRoot) {
256
+ return void 0;
257
+ }
258
+ return { type: "object" };
259
+ }
254
260
  if (typeof jsonSchema === "boolean") {
255
261
  return { type: "boolean", properties: {} };
256
262
  }
@@ -297,17 +303,19 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
297
303
  if (properties != null) {
298
304
  result.properties = Object.entries(properties).reduce(
299
305
  (acc, [key, value]) => {
300
- acc[key] = convertJSONSchemaToOpenAPISchema(value);
306
+ acc[key] = convertJSONSchemaToOpenAPISchema(value, false);
301
307
  return acc;
302
308
  },
303
309
  {}
304
310
  );
305
311
  }
306
312
  if (items) {
307
- result.items = Array.isArray(items) ? items.map(convertJSONSchemaToOpenAPISchema) : convertJSONSchemaToOpenAPISchema(items);
313
+ result.items = Array.isArray(items) ? items.map((item) => convertJSONSchemaToOpenAPISchema(item, false)) : convertJSONSchemaToOpenAPISchema(items, false);
308
314
  }
309
315
  if (allOf) {
310
- result.allOf = allOf.map(convertJSONSchemaToOpenAPISchema);
316
+ result.allOf = allOf.map(
317
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
318
+ );
311
319
  }
312
320
  if (anyOf) {
313
321
  if (anyOf.some(
@@ -317,21 +325,30 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
317
325
  (schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
318
326
  );
319
327
  if (nonNullSchemas.length === 1) {
320
- const converted = convertJSONSchemaToOpenAPISchema(nonNullSchemas[0]);
328
+ const converted = convertJSONSchemaToOpenAPISchema(
329
+ nonNullSchemas[0],
330
+ false
331
+ );
321
332
  if (typeof converted === "object") {
322
333
  result.nullable = true;
323
334
  Object.assign(result, converted);
324
335
  }
325
336
  } else {
326
- result.anyOf = nonNullSchemas.map(convertJSONSchemaToOpenAPISchema);
337
+ result.anyOf = nonNullSchemas.map(
338
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
339
+ );
327
340
  result.nullable = true;
328
341
  }
329
342
  } else {
330
- result.anyOf = anyOf.map(convertJSONSchemaToOpenAPISchema);
343
+ result.anyOf = anyOf.map(
344
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
345
+ );
331
346
  }
332
347
  }
333
348
  if (oneOf) {
334
- result.oneOf = oneOf.map(convertJSONSchemaToOpenAPISchema);
349
+ result.oneOf = oneOf.map(
350
+ (item) => convertJSONSchemaToOpenAPISchema(item, false)
351
+ );
335
352
  }
336
353
  if (minLength !== void 0) {
337
354
  result.minLength = minLength;
@@ -1756,14 +1773,26 @@ var GoogleGenerativeAIImageModel = class {
1756
1773
  const {
1757
1774
  prompt,
1758
1775
  n = 1,
1759
- size = "1024x1024",
1776
+ size,
1760
1777
  aspectRatio = "1:1",
1761
1778
  seed,
1762
1779
  providerOptions,
1763
1780
  headers,
1764
- abortSignal
1781
+ abortSignal,
1782
+ files,
1783
+ mask
1765
1784
  } = options;
1766
1785
  const warnings = [];
1786
+ if (files != null && files.length > 0) {
1787
+ throw new Error(
1788
+ "Google Generative AI does not support image editing. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
1789
+ );
1790
+ }
1791
+ if (mask != null) {
1792
+ throw new Error(
1793
+ "Google Generative AI does not support image editing with masks. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
1794
+ );
1795
+ }
1767
1796
  if (size != null) {
1768
1797
  warnings.push({
1769
1798
  type: "unsupported",