@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.
@@ -129,19 +129,6 @@ export declare interface AIOptions {
129
129
  backend: Backend;
130
130
  }
131
131
 
132
- /**
133
- * Schema class representing a value that can conform to any of the provided sub-schemas. This is
134
- * useful when a field can accept multiple distinct types or structures.
135
- * @public
136
- */
137
- export declare class AnyOfSchema extends Schema {
138
- anyOf: TypedSchema[];
139
- constructor(schemaParams: SchemaParams & {
140
- anyOf: TypedSchema[];
141
- });
142
- /* Excluded from this release type: toJSON */
143
- }
144
-
145
132
  declare interface ApiSettings {
146
133
  apiKey: string;
147
134
  project: string;
@@ -733,7 +720,7 @@ export declare interface GenerationConfig {
733
720
  * value can be a class generated with a {@link Schema} static method
734
721
  * like `Schema.string()` or `Schema.object()` or it can be a plain
735
722
  * JS object matching the {@link SchemaRequest} interface.
736
- * <br/>Note: This only applies when the specified `responseMimeType` supports a schema; currently
723
+ * <br/>Note: This only applies when the specified `responseMIMEType` supports a schema; currently
737
724
  * this is limited to `application/json` and `text/x.enum`.
738
725
  */
739
726
  responseSchema?: TypedSchema | SchemaRequest;
@@ -1851,11 +1838,10 @@ export declare interface SafetySetting {
1851
1838
  */
1852
1839
  export declare abstract class Schema implements SchemaInterface {
1853
1840
  /**
1854
- * Optional. The type of the property.
1855
- * This can only be undefined when using `anyOf` schemas, which do not have an
1856
- * explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification}.
1841
+ * Optional. The type of the property. {@link
1842
+ * (SchemaType:type)}.
1857
1843
  */
1858
- type?: SchemaType;
1844
+ type: SchemaType;
1859
1845
  /** Optional. The format of the property.
1860
1846
  * Supported formats:<br/>
1861
1847
  * <ul>
@@ -1900,9 +1886,6 @@ export declare abstract class Schema implements SchemaInterface {
1900
1886
  static integer(integerParams?: SchemaParams): IntegerSchema;
1901
1887
  static number(numberParams?: SchemaParams): NumberSchema;
1902
1888
  static boolean(booleanParams?: SchemaParams): BooleanSchema;
1903
- static anyOf(anyOfParams: SchemaParams & {
1904
- anyOf: TypedSchema[];
1905
- }): AnyOfSchema;
1906
1889
  }
1907
1890
 
1908
1891
  /**
@@ -1911,10 +1894,10 @@ export declare abstract class Schema implements SchemaInterface {
1911
1894
  */
1912
1895
  export declare interface SchemaInterface extends SchemaShared<SchemaInterface> {
1913
1896
  /**
1914
- * The type of the property. this can only be undefined when using `anyof` schemas,
1915
- * which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI Specification}.
1897
+ * The type of the property. {@link
1898
+ * (SchemaType:type)}.
1916
1899
  */
1917
- type?: SchemaType;
1900
+ type: SchemaType;
1918
1901
  }
1919
1902
 
1920
1903
  /**
@@ -1931,10 +1914,10 @@ export declare interface SchemaParams extends SchemaShared<SchemaInterface> {
1931
1914
  */
1932
1915
  export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
1933
1916
  /**
1934
- * The type of the property. this can only be undefined when using `anyOf` schemas,
1935
- * which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification }.
1917
+ * The type of the property. {@link
1918
+ * (SchemaType:type)}.
1936
1919
  */
1937
- type?: SchemaType;
1920
+ type: SchemaType;
1938
1921
  /** Optional. Array of required property. */
1939
1922
  required?: string[];
1940
1923
  }
@@ -1945,12 +1928,6 @@ export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
1945
1928
  * @public
1946
1929
  */
1947
1930
  export declare interface SchemaShared<T> {
1948
- /**
1949
- * An array of {@link Schema}. The generated data must be valid against any of the schemas
1950
- * listed in this array. This allows specifying multiple possible structures or types for a
1951
- * single field.
1952
- */
1953
- anyOf?: T[];
1954
1931
  /** Optional. The format of the property.
1955
1932
  * When using the Gemini Developer API ({@link GoogleAIBackend}), this must be either `'enum'` or
1956
1933
  * `'date-time'`, otherwise requests will fail.
@@ -2149,7 +2126,7 @@ export declare interface ToolConfig {
2149
2126
  * A type that includes all specific Schema types.
2150
2127
  * @public
2151
2128
  */
2152
- export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
2129
+ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
2153
2130
 
2154
2131
  /**
2155
2132
  * Usage metadata about a {@link GenerateContentResponse}.
package/dist/ai.d.ts CHANGED
@@ -163,22 +163,6 @@ export declare interface AIOptions {
163
163
  backend: Backend;
164
164
  }
165
165
 
166
- /**
167
- * Schema class representing a value that can conform to any of the provided sub-schemas. This is
168
- * useful when a field can accept multiple distinct types or structures.
169
- * @public
170
- */
171
- export declare class AnyOfSchema extends Schema {
172
- anyOf: TypedSchema[];
173
- constructor(schemaParams: SchemaParams & {
174
- anyOf: TypedSchema[];
175
- });
176
- /**
177
- * @internal
178
- */
179
- toJSON(): SchemaRequest;
180
- }
181
-
182
166
  declare interface ApiSettings {
183
167
  apiKey: string;
184
168
  project: string;
@@ -773,7 +757,7 @@ export declare interface GenerationConfig {
773
757
  * value can be a class generated with a {@link Schema} static method
774
758
  * like `Schema.string()` or `Schema.object()` or it can be a plain
775
759
  * JS object matching the {@link SchemaRequest} interface.
776
- * <br/>Note: This only applies when the specified `responseMimeType` supports a schema; currently
760
+ * <br/>Note: This only applies when the specified `responseMIMEType` supports a schema; currently
777
761
  * this is limited to `application/json` and `text/x.enum`.
778
762
  */
779
763
  responseSchema?: TypedSchema | SchemaRequest;
@@ -1947,11 +1931,10 @@ export declare interface SafetySetting {
1947
1931
  */
1948
1932
  export declare abstract class Schema implements SchemaInterface {
1949
1933
  /**
1950
- * Optional. The type of the property.
1951
- * This can only be undefined when using `anyOf` schemas, which do not have an
1952
- * explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification}.
1934
+ * Optional. The type of the property. {@link
1935
+ * (SchemaType:type)}.
1953
1936
  */
1954
- type?: SchemaType;
1937
+ type: SchemaType;
1955
1938
  /** Optional. The format of the property.
1956
1939
  * Supported formats:<br/>
1957
1940
  * <ul>
@@ -2001,9 +1984,6 @@ export declare abstract class Schema implements SchemaInterface {
2001
1984
  static integer(integerParams?: SchemaParams): IntegerSchema;
2002
1985
  static number(numberParams?: SchemaParams): NumberSchema;
2003
1986
  static boolean(booleanParams?: SchemaParams): BooleanSchema;
2004
- static anyOf(anyOfParams: SchemaParams & {
2005
- anyOf: TypedSchema[];
2006
- }): AnyOfSchema;
2007
1987
  }
2008
1988
 
2009
1989
  /**
@@ -2012,10 +1992,10 @@ export declare abstract class Schema implements SchemaInterface {
2012
1992
  */
2013
1993
  export declare interface SchemaInterface extends SchemaShared<SchemaInterface> {
2014
1994
  /**
2015
- * The type of the property. this can only be undefined when using `anyof` schemas,
2016
- * which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI Specification}.
1995
+ * The type of the property. {@link
1996
+ * (SchemaType:type)}.
2017
1997
  */
2018
- type?: SchemaType;
1998
+ type: SchemaType;
2019
1999
  }
2020
2000
 
2021
2001
  /**
@@ -2032,10 +2012,10 @@ export declare interface SchemaParams extends SchemaShared<SchemaInterface> {
2032
2012
  */
2033
2013
  export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
2034
2014
  /**
2035
- * The type of the property. this can only be undefined when using `anyOf` schemas,
2036
- * which do not have an explicit type in the {@link https://swagger.io/docs/specification/v3_0/data-models/data-types/#any-type | OpenAPI specification }.
2015
+ * The type of the property. {@link
2016
+ * (SchemaType:type)}.
2037
2017
  */
2038
- type?: SchemaType;
2018
+ type: SchemaType;
2039
2019
  /** Optional. Array of required property. */
2040
2020
  required?: string[];
2041
2021
  }
@@ -2046,12 +2026,6 @@ export declare interface SchemaRequest extends SchemaShared<SchemaRequest> {
2046
2026
  * @public
2047
2027
  */
2048
2028
  export declare interface SchemaShared<T> {
2049
- /**
2050
- * An array of {@link Schema}. The generated data must be valid against any of the schemas
2051
- * listed in this array. This allows specifying multiple possible structures or types for a
2052
- * single field.
2053
- */
2054
- anyOf?: T[];
2055
2029
  /** Optional. The format of the property.
2056
2030
  * When using the Gemini Developer API ({@link GoogleAIBackend}), this must be either `'enum'` or
2057
2031
  * `'date-time'`, otherwise requests will fail.
@@ -2253,7 +2227,7 @@ export declare interface ToolConfig {
2253
2227
  * A type that includes all specific Schema types.
2254
2228
  * @public
2255
2229
  */
2256
- export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
2230
+ export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema;
2257
2231
 
2258
2232
  /**
2259
2233
  * Usage metadata about a {@link GenerateContentResponse}.
@@ -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.5200f7bb7";
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, AnyOfSchema, 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 };
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.esm.js.map