FirebaseVertexAI

classFirebaseVertexAI


Entry point for allVertex AI in Firebase functionality.

Summary

Public companion functions

FirebaseVertexAI
FirebaseVertexAI
getInstance(app: FirebaseApp, location: String)

Returns theFirebaseVertexAI instance for the providedFirebaseApp andlocation.

Public companion properties

FirebaseVertexAI

TheFirebaseVertexAI instance for the defaultFirebaseApp

Public functions

GenerativeModel
generativeModel(
    modelName: String,
    generationConfig: GenerationConfig?,
    safetySettings: List<SafetySetting>?,
    tools: List<Tool>?,
    toolConfig: ToolConfig?,
    systemInstruction: Content?,
    requestOptions: RequestOptions
)

Instantiates a newGenerativeModel given the provided parameters.

ImagenModel
@PublicPreviewAPI
imagenModel(
    modelName: String,
    generationConfig: ImagenGenerationConfig?,
    safetySettings: ImagenSafetySettings?,
    requestOptions: RequestOptions
)

Instantiates a newImagenModel given the provided parameters.

LiveGenerativeModel
@PublicPreviewAPI
liveModel(
    modelName: String,
    generationConfig: LiveGenerationConfig?,
    tools: List<Tool>?,
    systemInstruction: Content?,
    requestOptions: RequestOptions
)

Instantiates a newLiveGenerationConfig given the provided parameters.

Public companion functions

getInstance

fun getInstance(app: FirebaseApp): FirebaseVertexAI

getInstance

fun getInstance(app: FirebaseApp = Firebase.app, location: String): FirebaseVertexAI

Returns theFirebaseVertexAI instance for the providedFirebaseApp andlocation.

Parameters
location: String

location identifier, defaults tous-central1; see availableVertex AI regions .

Public companion properties

instance

val instanceFirebaseVertexAI

TheFirebaseVertexAI instance for the defaultFirebaseApp

Public functions

generativeModel

fun generativeModel(
    modelName: String,
    generationConfig: GenerationConfig? = null,
    safetySettings: List<SafetySetting>? = null,
    tools: List<Tool>? = null,
    toolConfig: ToolConfig? = null,
    systemInstruction: Content? = null,
    requestOptions: RequestOptions = RequestOptions()
): GenerativeModel

Instantiates a newGenerativeModel given the provided parameters.

Parameters
modelName: String

The name of the model to use, for example"gemini-2.0-flash-exp".

generationConfig: GenerationConfig? = null

The configuration parameters to use for content generation.

safetySettings: List<SafetySetting>? = null

The safety bounds the model will abide to during content generation.

tools: List<Tool>? = null

A list ofTools the model may use to generate content.

toolConfig: ToolConfig? = null

TheToolConfig that defines how the model handles the tools provided.

systemInstruction: Content? = null

Content instructions that direct the model to behave a certain way. Currently only text content is supported.

requestOptions: RequestOptions = RequestOptions()

Configuration options for sending requests to the backend.

Returns
GenerativeModel

The initializedGenerativeModel instance.

imagenModel

@PublicPreviewAPI
fun imagenModel(
    modelName: String,
    generationConfig: ImagenGenerationConfig? = null,
    safetySettings: ImagenSafetySettings? = null,
    requestOptions: RequestOptions = RequestOptions()
): ImagenModel

Instantiates a newImagenModel given the provided parameters.

Parameters
modelName: String

The name of the model to use, for example"imagen-3.0-generate-001".

generationConfig: ImagenGenerationConfig? = null

The configuration parameters to use for image generation.

safetySettings: ImagenSafetySettings? = null

The safety bounds the model will abide by during image generation.

requestOptions: RequestOptions = RequestOptions()

Configuration options for sending requests to the backend.

Returns
ImagenModel

The initializedImagenModel instance.

liveModel

@PublicPreviewAPI
fun liveModel(
    modelName: String,
    generationConfig: LiveGenerationConfig? = null,
    tools: List<Tool>? = null,
    systemInstruction: Content? = null,
    requestOptions: RequestOptions = RequestOptions()
): LiveGenerativeModel

Instantiates a newLiveGenerationConfig given the provided parameters.

Parameters
modelName: String

The name of the model to use, for example"gemini-2.0-flash-exp".

generationConfig: LiveGenerationConfig? = null

The configuration parameters to use for content generation.

tools: List<Tool>? = null

A list ofTools the model may use to generate content.

systemInstruction: Content? = null

Content instructions that direct the model to behave a certain way. Currently only text content is supported.

requestOptions: RequestOptions = RequestOptions()

Configuration options for sending requests to the backend.

Returns
LiveGenerativeModel

The initializedLiveGenerativeModel instance.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.