@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 +15 -0
- package/dist/index.js +41 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -12
- 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 +5 -5
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;
|
|
@@ -1792,14 +1809,26 @@ var GoogleGenerativeAIImageModel = class {
|
|
|
1792
1809
|
const {
|
|
1793
1810
|
prompt,
|
|
1794
1811
|
n = 1,
|
|
1795
|
-
size
|
|
1812
|
+
size,
|
|
1796
1813
|
aspectRatio = "1:1",
|
|
1797
1814
|
seed,
|
|
1798
1815
|
providerOptions,
|
|
1799
1816
|
headers,
|
|
1800
|
-
abortSignal
|
|
1817
|
+
abortSignal,
|
|
1818
|
+
files,
|
|
1819
|
+
mask
|
|
1801
1820
|
} = options;
|
|
1802
1821
|
const warnings = [];
|
|
1822
|
+
if (files != null && files.length > 0) {
|
|
1823
|
+
throw new Error(
|
|
1824
|
+
"Google Generative AI does not support image editing. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
if (mask != null) {
|
|
1828
|
+
throw new Error(
|
|
1829
|
+
"Google Generative AI does not support image editing with masks. Use Google Vertex AI (@ai-sdk/google-vertex) for image editing capabilities."
|
|
1830
|
+
);
|
|
1831
|
+
}
|
|
1803
1832
|
if (size != null) {
|
|
1804
1833
|
warnings.push({
|
|
1805
1834
|
type: "unsupported",
|