@firebase/ai 1.4.1-canary.5200f7bb7 → 1.4.1-canary.cb19688bf
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/dist/ai-public.d.ts +11 -34
- package/dist/ai.d.ts +11 -37
- package/dist/esm/index.esm.js +2 -40
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/requests/schema-builder.d.ts +4 -23
- package/dist/esm/src/types/requests.d.ts +1 -1
- package/dist/esm/src/types/schema.d.ts +6 -12
- package/dist/index.cjs.js +1 -40
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +1 -40
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +2 -40
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/requests/schema-builder.d.ts +4 -23
- package/dist/src/types/requests.d.ts +1 -1
- package/dist/src/types/schema.d.ts +6 -12
- package/package.json +8 -8
package/dist/index.node.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var util = require('@firebase/util');
|
|
|
8
8
|
var logger$1 = require('@firebase/logger');
|
|
9
9
|
|
|
10
10
|
var name = "@firebase/ai";
|
|
11
|
-
var version = "1.4.1-canary.
|
|
11
|
+
var version = "1.4.1-canary.cb19688bf";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
@@ -2311,19 +2311,12 @@ class ImagenModel extends AIModel {
|
|
|
2311
2311
|
*/
|
|
2312
2312
|
class Schema {
|
|
2313
2313
|
constructor(schemaParams) {
|
|
2314
|
-
// TODO(dlarocque): Enforce this with union types
|
|
2315
|
-
if (!schemaParams.type && !schemaParams.anyOf) {
|
|
2316
|
-
throw new AIError(AIErrorCode.INVALID_SCHEMA, "A schema must have either a 'type' or an 'anyOf' array of sub-schemas.");
|
|
2317
|
-
}
|
|
2318
2314
|
// eslint-disable-next-line guard-for-in
|
|
2319
2315
|
for (const paramKey in schemaParams) {
|
|
2320
2316
|
this[paramKey] = schemaParams[paramKey];
|
|
2321
2317
|
}
|
|
2322
2318
|
// Ensure these are explicitly set to avoid TS errors.
|
|
2323
2319
|
this.type = schemaParams.type;
|
|
2324
|
-
this.format = schemaParams.hasOwnProperty('format')
|
|
2325
|
-
? schemaParams.format
|
|
2326
|
-
: undefined;
|
|
2327
2320
|
this.nullable = schemaParams.hasOwnProperty('nullable')
|
|
2328
2321
|
? !!schemaParams.nullable
|
|
2329
2322
|
: false;
|
|
@@ -2370,9 +2363,6 @@ class Schema {
|
|
|
2370
2363
|
static boolean(booleanParams) {
|
|
2371
2364
|
return new BooleanSchema(booleanParams);
|
|
2372
2365
|
}
|
|
2373
|
-
static anyOf(anyOfParams) {
|
|
2374
|
-
return new AnyOfSchema(anyOfParams);
|
|
2375
|
-
}
|
|
2376
2366
|
}
|
|
2377
2367
|
/**
|
|
2378
2368
|
* Schema class for "integer" types.
|
|
@@ -2500,34 +2490,6 @@ class ObjectSchema extends Schema {
|
|
|
2500
2490
|
return obj;
|
|
2501
2491
|
}
|
|
2502
2492
|
}
|
|
2503
|
-
/**
|
|
2504
|
-
* Schema class representing a value that can conform to any of the provided sub-schemas. This is
|
|
2505
|
-
* useful when a field can accept multiple distinct types or structures.
|
|
2506
|
-
* @public
|
|
2507
|
-
*/
|
|
2508
|
-
class AnyOfSchema extends Schema {
|
|
2509
|
-
constructor(schemaParams) {
|
|
2510
|
-
if (schemaParams.anyOf.length === 0) {
|
|
2511
|
-
throw new AIError(AIErrorCode.INVALID_SCHEMA, "The 'anyOf' array must not be empty.");
|
|
2512
|
-
}
|
|
2513
|
-
super({
|
|
2514
|
-
...schemaParams,
|
|
2515
|
-
type: undefined // anyOf schemas do not have an explicit type
|
|
2516
|
-
});
|
|
2517
|
-
this.anyOf = schemaParams.anyOf;
|
|
2518
|
-
}
|
|
2519
|
-
/**
|
|
2520
|
-
* @internal
|
|
2521
|
-
*/
|
|
2522
|
-
toJSON() {
|
|
2523
|
-
const obj = super.toJSON();
|
|
2524
|
-
// Ensure the 'anyOf' property contains serialized SchemaRequest objects.
|
|
2525
|
-
if (this.anyOf && Array.isArray(this.anyOf)) {
|
|
2526
|
-
obj.anyOf = this.anyOf.map(s => s.toJSON());
|
|
2527
|
-
}
|
|
2528
|
-
return obj;
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
2493
|
|
|
2532
2494
|
/**
|
|
2533
2495
|
* @license
|
|
@@ -2705,7 +2667,6 @@ registerAI();
|
|
|
2705
2667
|
exports.AIError = AIError;
|
|
2706
2668
|
exports.AIErrorCode = AIErrorCode;
|
|
2707
2669
|
exports.AIModel = AIModel;
|
|
2708
|
-
exports.AnyOfSchema = AnyOfSchema;
|
|
2709
2670
|
exports.ArraySchema = ArraySchema;
|
|
2710
2671
|
exports.Backend = Backend;
|
|
2711
2672
|
exports.BackendType = BackendType;
|