@@ -18,6 +18,18 @@ export class ArraySchema extends Schema {
1818 toJSON(): SchemaRequest ;
1919}
2020
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+
2133// @public
2234export interface BaseParams {
2335 // (undocumented)
@@ -239,6 +251,60 @@ export interface FunctionResponsePart {
239251 text? : never ;
240252}
241253
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 (undocumented)
300+ static normalizeModelName(modelName : string , backendType : BackendType ): string ;
301+ }
302+
303+ // @public
304+ export interface GenAIOptions {
305+ backend: Backend ;
306+ }
307+
242308// @public
243309export interface GenerateContentCandidate {
244310 // (undocumented)
@@ -323,8 +389,8 @@ export interface GenerativeContentBlob {
323389}
324390
325391// @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 );
328394 countTokens(request : CountTokensRequest | string | Array <string | Part >): Promise <CountTokensResponse >;
329395 generateContent(request : GenerateContentRequest | string | Array <string | Part >): Promise <GenerateContentResult >;
330396 generateContentStream(request : GenerateContentRequest | string | Array <string | Part >): Promise <GenerateContentStreamResult >;
@@ -344,14 +410,25 @@ export class GenerativeModel extends VertexAIModel {
344410}
345411
346412// @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 ;
348417
349418// @beta
350- export function getImagenModel(vertexAI : VertexAI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
419+ export function getImagenModel(genAI : GenAI , modelParams : ImagenModelParams , requestOptions ? : RequestOptions ): ImagenModel ;
351420
352421// @public
353422export function getVertexAI(app ? : FirebaseApp , options ? : VertexAIOptions ): VertexAI ;
354423
424+ // @public
425+ export type GoogleAIBackend = {
426+ backendType: typeof BackendType .GOOGLE_AI ;
427+ };
428+
429+ // @public
430+ export function googleAIBackend(): GoogleAIBackend ;
431+
355432// @public @deprecated (undocumented)
356433export interface GroundingAttribution {
357434 // (undocumented)
@@ -413,7 +490,8 @@ export enum HarmSeverity {
413490 HARM_SEVERITY_HIGH = " HARM_SEVERITY_HIGH" ,
414491 HARM_SEVERITY_LOW = " HARM_SEVERITY_LOW" ,
415492 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"
417495}
418496
419497// @beta
@@ -461,8 +539,8 @@ export interface ImagenInlineImage {
461539}
462540
463541// @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 );
466544 generateImages(prompt : string ): Promise <ImagenGenerationResponse <ImagenInlineImage >>;
467545 // @internal
468546 generateImagesGCS(prompt : string , gcsURI : string ): Promise <ImagenGenerationResponse <ImagenGCSImage >>;
@@ -627,7 +705,6 @@ export interface SafetyRating {
627705export interface SafetySetting {
628706 // (undocumented)
629707 category: HarmCategory ;
630- // (undocumented)
631708 method? : HarmBlockMethod ;
632709 // (undocumented)
633710 threshold: HarmBlockThreshold ;
@@ -779,46 +856,22 @@ export interface UsageMetadata {
779856}
780857
781858// @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 ;
785864 location: string ;
786- }
865+ };
787866
788867// @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 ;
796869
797870// @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 ;
812872
813873// @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 ;
822875
823876// @public
824877export interface VertexAIOptions {
@@ -841,4 +894,6 @@ export interface WebAttribution {
841894}
842895
843896
897+ // (No @packageDocumentation comment for this package)
898+
844899```
0 commit comments