@@ -18,6 +18,18 @@ export class ArraySchema extends Schema {
18
18
toJSON(): SchemaRequest ;
19
19
}
20
20
21
+ // @public
22
+ export type Backend = GoogleAIBackend | VertexAIBackend ;
23
+
24
+ // @public
25
+ export const BackendType: {
26
+ readonly VERTEX_AI: " VERTEX_AI" ;
27
+ readonly GOOGLE_AI: " GOOGLE_AI" ;
28
+ };
29
+
30
+ // @public
31
+ export type BackendType = (typeof BackendType )[keyof typeof BackendType ];
32
+
21
33
// @public
22
34
export interface BaseParams {
23
35
// (undocumented)
@@ -239,6 +251,60 @@ export interface FunctionResponsePart {
239
251
text? : never ;
240
252
}
241
253
254
+ // @public
255
+ export interface GenAI {
256
+ app: FirebaseApp ;
257
+ backend: Backend ;
258
+ // @deprecated
259
+ location: string ;
260
+ }
261
+
262
+ // @public
263
+ export class GenAIError extends FirebaseError {
264
+ constructor (code : GenAIErrorCode , message : string , customErrorData ? : CustomErrorData | undefined );
265
+ // (undocumented)
266
+ readonly code: GenAIErrorCode ;
267
+ // (undocumented)
268
+ readonly customErrorData? : CustomErrorData | undefined ;
269
+ }
270
+
271
+ // @public
272
+ const enum GenAIErrorCode {
273
+ API_NOT_ENABLED = " api-not-enabled" ,
274
+ ERROR = " error" ,
275
+ FETCH_ERROR = " fetch-error" ,
276
+ INVALID_CONTENT = " invalid-content" ,
277
+ INVALID_SCHEMA = " invalid-schema" ,
278
+ NO_API_KEY = " no-api-key" ,
279
+ NO_APP_ID = " no-app-id" ,
280
+ NO_MODEL = " no-model" ,
281
+ NO_PROJECT_ID = " no-project-id" ,
282
+ PARSE_FAILED = " parse-failed" ,
283
+ REQUEST_ERROR = " request-error" ,
284
+ RESPONSE_ERROR = " response-error" ,
285
+ UNSUPPORTED = " unsupported"
286
+ }
287
+
288
+ export { GenAIErrorCode }
289
+
290
+ export { GenAIErrorCode as VertexAIErrorCode }
291
+
292
+ // @public
293
+ export abstract class GenAIModel {
294
+ // @internal
295
+ protected constructor (genAI : GenAI , modelName : string );
296
+ // @internal (undocumented)
297
+ protected _apiSettings: ApiSettings ;
298
+ readonly model: string ;
299
+ // @internal
300
+ static normalizeModelName(modelName : string , backendType : BackendType ): string ;
301
+ }
302
+
303
+ // @public
304
+ export interface GenAIOptions {
305
+ backend: Backend ;
306
+ }
307
+
242
308
// @public
243
309
export interface GenerateContentCandidate {
244
310
// (undocumented)
@@ -323,8 +389,8 @@ export interface GenerativeContentBlob {
323
389
}
324
390
325
391
// @public
326
- export class GenerativeModel extends VertexAIModel {
327
- constructor (vertexAI : VertexAI , modelParams : ModelParams , requestOptions ? : RequestOptions );
392
+ export class GenerativeModel extends GenAIModel {
393
+ constructor (genAI : GenAI , modelParams : ModelParams , requestOptions ? : RequestOptions );
328
394
countTokens(request : CountTokensRequest | string | Array <string | Part >): Promise <CountTokensResponse >;
329
395
generateContent(request : GenerateContentRequest | string | Array <string | Part >): Promise <GenerateContentResult >;
330
396
generateContentStream(request : GenerateContentRequest | string | Array <string | Part >): Promise <GenerateContentStreamResult >;
@@ -344,14 +410,25 @@ export class GenerativeModel extends VertexAIModel {
344
410
}
345
411
346
412
// @public
347
- export function getGenerativeModel(vertexAI : VertexAI , modelParams : ModelParams , requestOptions ? : RequestOptions ): GenerativeModel ;
413
+ export function getGenAI(app ? : FirebaseApp , options ? : GenAIOptions ): GenAI ;
414
+
415
+ // @public
416
+ export function getGenerativeModel(genAI : GenAI , modelParams : ModelParams , requestOptions ? : RequestOptions ): GenerativeModel ;
348
417
349
418
// @beta
350
- export function getImagenModel(vertexAI : VertexAI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
419
+ export function getImagenModel(genAI : GenAI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
351
420
352
421
// @public
353
422
export function getVertexAI(app ? : FirebaseApp , options ? : VertexAIOptions ): VertexAI ;
354
423
424
+ // @public
425
+ export type GoogleAIBackend = {
426
+ backendType: typeof BackendType .GOOGLE_AI ;
427
+ };
428
+
429
+ // @public
430
+ export function googleAIBackend(): GoogleAIBackend ;
431
+
355
432
// @public @deprecated (undocumented)
356
433
export interface GroundingAttribution {
357
434
// (undocumented)
@@ -374,7 +451,7 @@ export interface GroundingMetadata {
374
451
webSearchQueries? : string [];
375
452
}
376
453
377
- // @public (undocumented)
454
+ // @public
378
455
export enum HarmBlockMethod {
379
456
PROBABILITY = " PROBABILITY" ,
380
457
SEVERITY = " SEVERITY"
@@ -413,7 +490,8 @@ export enum HarmSeverity {
413
490
HARM_SEVERITY_HIGH = " HARM_SEVERITY_HIGH" ,
414
491
HARM_SEVERITY_LOW = " HARM_SEVERITY_LOW" ,
415
492
HARM_SEVERITY_MEDIUM = " HARM_SEVERITY_MEDIUM" ,
416
- HARM_SEVERITY_NEGLIGIBLE = " HARM_SEVERITY_NEGLIGIBLE"
493
+ HARM_SEVERITY_NEGLIGIBLE = " HARM_SEVERITY_NEGLIGIBLE" ,
494
+ HARM_SEVERITY_UNSUPPORTED = " HARM_SEVERITY_UNSUPPORTED"
417
495
}
418
496
419
497
// @beta
@@ -461,8 +539,8 @@ export interface ImagenInlineImage {
461
539
}
462
540
463
541
// @beta
464
- export class ImagenModel extends VertexAIModel {
465
- constructor (vertexAI : VertexAI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions | undefined );
542
+ export class ImagenModel extends GenAIModel {
543
+ constructor (genAI : GenAI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions | undefined );
466
544
generateImages(prompt : string ): Promise <ImagenGenerationResponse <ImagenInlineImage >>;
467
545
// @internal
468
546
generateImagesGCS(prompt : string , gcsURI : string ): Promise <ImagenGenerationResponse <ImagenGCSImage >>;
@@ -627,7 +705,6 @@ export interface SafetyRating {
627
705
export interface SafetySetting {
628
706
// (undocumented)
629
707
category: HarmCategory ;
630
- // (undocumented)
631
708
method? : HarmBlockMethod ;
632
709
// (undocumented)
633
710
threshold: HarmBlockThreshold ;
@@ -779,46 +856,22 @@ export interface UsageMetadata {
779
856
}
780
857
781
858
// @public
782
- export interface VertexAI {
783
- app: FirebaseApp ;
784
- // (undocumented)
859
+ export type VertexAI = GenAI ;
860
+
861
+ // @public
862
+ export type VertexAIBackend = {
863
+ backendType: typeof BackendType .VERTEX_AI ;
785
864
location: string ;
786
- }
865
+ };
787
866
788
867
// @public
789
- export class VertexAIError extends FirebaseError {
790
- constructor (code : VertexAIErrorCode , message : string , customErrorData ? : CustomErrorData | undefined );
791
- // (undocumented)
792
- readonly code: VertexAIErrorCode ;
793
- // (undocumented)
794
- readonly customErrorData? : CustomErrorData | undefined ;
795
- }
868
+ export function vertexAIBackend(location ? : string ): VertexAIBackend ;
796
869
797
870
// @public
798
- export const enum VertexAIErrorCode {
799
- API_NOT_ENABLED = " api-not-enabled" ,
800
- ERROR = " error" ,
801
- FETCH_ERROR = " fetch-error" ,
802
- INVALID_CONTENT = " invalid-content" ,
803
- INVALID_SCHEMA = " invalid-schema" ,
804
- NO_API_KEY = " no-api-key" ,
805
- NO_APP_ID = " no-app-id" ,
806
- NO_MODEL = " no-model" ,
807
- NO_PROJECT_ID = " no-project-id" ,
808
- PARSE_FAILED = " parse-failed" ,
809
- REQUEST_ERROR = " request-error" ,
810
- RESPONSE_ERROR = " response-error"
811
- }
871
+ export const VertexAIError: typeof GenAIError ;
812
872
813
873
// @public
814
- export abstract class VertexAIModel {
815
- // @internal
816
- protected constructor (vertexAI : VertexAI , modelName : string );
817
- // @internal (undocumented)
818
- protected _apiSettings: ApiSettings ;
819
- readonly model: string ;
820
- static normalizeModelName(modelName : string ): string ;
821
- }
874
+ export const VertexAIModel: typeof GenAIModel ;
822
875
823
876
// @public
824
877
export interface VertexAIOptions {
0 commit comments