@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.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { FirebaseError, getModularInstance } from '@firebase/util';
|
|
|
4
4
|
import { Logger } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
var name = "@firebase/ai";
|
|
7
|
-
var version = "1.4.1-canary.
|
|
7
|
+
var version = "1.4.1-canary.cb19688bf";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -2307,19 +2307,12 @@ class ImagenModel extends AIModel {
|
|
|
2307
2307
|
*/
|
|
2308
2308
|
class Schema {
|
|
2309
2309
|
constructor(schemaParams) {
|
|
2310
|
-
// TODO(dlarocque): Enforce this with union types
|
|
2311
|
-
if (!schemaParams.type && !schemaParams.anyOf) {
|
|
2312
|
-
throw new AIError(AIErrorCode.INVALID_SCHEMA, "A schema must have either a 'type' or an 'anyOf' array of sub-schemas.");
|
|
2313
|
-
}
|
|
2314
2310
|
// eslint-disable-next-line guard-for-in
|
|
2315
2311
|
for (const paramKey in schemaParams) {
|
|
2316
2312
|
this[paramKey] = schemaParams[paramKey];
|
|
2317
2313
|
}
|
|
2318
2314
|
// Ensure these are explicitly set to avoid TS errors.
|
|
2319
2315
|
this.type = schemaParams.type;
|
|
2320
|
-
this.format = schemaParams.hasOwnProperty('format')
|
|
2321
|
-
? schemaParams.format
|
|
2322
|
-
: undefined;
|
|
2323
2316
|
this.nullable = schemaParams.hasOwnProperty('nullable')
|
|
2324
2317
|
? !!schemaParams.nullable
|
|
2325
2318
|
: false;
|
|
@@ -2366,9 +2359,6 @@ class Schema {
|
|
|
2366
2359
|
static boolean(booleanParams) {
|
|
2367
2360
|
return new BooleanSchema(booleanParams);
|
|
2368
2361
|
}
|
|
2369
|
-
static anyOf(anyOfParams) {
|
|
2370
|
-
return new AnyOfSchema(anyOfParams);
|
|
2371
|
-
}
|
|
2372
2362
|
}
|
|
2373
2363
|
/**
|
|
2374
2364
|
* Schema class for "integer" types.
|
|
@@ -2496,34 +2486,6 @@ class ObjectSchema extends Schema {
|
|
|
2496
2486
|
return obj;
|
|
2497
2487
|
}
|
|
2498
2488
|
}
|
|
2499
|
-
/**
|
|
2500
|
-
* Schema class representing a value that can conform to any of the provided sub-schemas. This is
|
|
2501
|
-
* useful when a field can accept multiple distinct types or structures.
|
|
2502
|
-
* @public
|
|
2503
|
-
*/
|
|
2504
|
-
class AnyOfSchema extends Schema {
|
|
2505
|
-
constructor(schemaParams) {
|
|
2506
|
-
if (schemaParams.anyOf.length === 0) {
|
|
2507
|
-
throw new AIError(AIErrorCode.INVALID_SCHEMA, "The 'anyOf' array must not be empty.");
|
|
2508
|
-
}
|
|
2509
|
-
super({
|
|
2510
|
-
...schemaParams,
|
|
2511
|
-
type: undefined // anyOf schemas do not have an explicit type
|
|
2512
|
-
});
|
|
2513
|
-
this.anyOf = schemaParams.anyOf;
|
|
2514
|
-
}
|
|
2515
|
-
/**
|
|
2516
|
-
* @internal
|
|
2517
|
-
*/
|
|
2518
|
-
toJSON() {
|
|
2519
|
-
const obj = super.toJSON();
|
|
2520
|
-
// Ensure the 'anyOf' property contains serialized SchemaRequest objects.
|
|
2521
|
-
if (this.anyOf && Array.isArray(this.anyOf)) {
|
|
2522
|
-
obj.anyOf = this.anyOf.map(s => s.toJSON());
|
|
2523
|
-
}
|
|
2524
|
-
return obj;
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
2489
|
|
|
2528
2490
|
/**
|
|
2529
2491
|
* @license
|
|
@@ -2698,5 +2660,5 @@ function registerAI() {
|
|
|
2698
2660
|
}
|
|
2699
2661
|
registerAI();
|
|
2700
2662
|
|
|
2701
|
-
export { AIError, AIErrorCode, AIModel,
|
|
2663
|
+
export { AIError, AIErrorCode, AIModel, ArraySchema, Backend, BackendType, BlockReason, BooleanSchema, ChatSession, FinishReason, FunctionCallingMode, GenerativeModel, GoogleAIBackend, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, ImagenAspectRatio, ImagenImageFormat, ImagenModel, ImagenPersonFilterLevel, ImagenSafetyFilterLevel, IntegerSchema, Modality, NumberSchema, ObjectSchema, POSSIBLE_ROLES, ResponseModality, Schema, SchemaType, StringSchema, VertexAIBackend, getAI, getGenerativeModel, getImagenModel };
|
|
2702
2664
|
//# sourceMappingURL=index.node.mjs.map
|