FirebaseAI
class FirebaseAI
Entry point for all Firebase AI functionality.
Summary
Public companion functions |
|
|---|---|
FirebaseAI |
getInstance(app: FirebaseApp)The |
FirebaseAI |
getInstance(app: FirebaseApp, backend: GenerativeBackend)Returns the |
FirebaseAI |
getInstance(Returns the |
Public companion properties |
|
|---|---|
FirebaseAI |
The |
Public functions |
|
|---|---|
GenerativeModel |
generativeModel(Instantiates a new |
ImagenModel |
imagenModel(Instantiates a new |
LiveGenerativeModel |
@PublicPreviewAPIInstantiates a new |
TemplateGenerativeModel |
@PublicPreviewAPIInstantiates a new |
TemplateImagenModel |
@PublicPreviewAPIInstantiates a new |
Public companion functions
getInstance
fun getInstance(app: FirebaseApp): FirebaseAI
The FirebaseAI instance for the provided FirebaseApp using the Google AI Backend.
getInstance
fun getInstance(app: FirebaseApp = Firebase.app, backend: GenerativeBackend): FirebaseAI
Returns the FirebaseAI instance for the provided FirebaseApp and backend.
| Parameters | |
|---|---|
backend: GenerativeBackend |
the backend reference to make generative AI requests to. |
getInstance
fun getInstance(
app: FirebaseApp = Firebase.app,
backend: GenerativeBackend,
useLimitedUseAppCheckTokens: Boolean
): FirebaseAI
Returns the FirebaseAI instance for the provided FirebaseApp and backend.
| Parameters | |
|---|---|
backend: GenerativeBackend |
the backend reference to make generative AI requests to. |
useLimitedUseAppCheckTokens: Boolean |
when sending tokens to the backend, this option enables the usage of App Check's limited-use tokens instead of the standard cached tokens. Learn more about limited-use tokens, including their nuances, when to use them, and best practices for integrating them into your app. This flag is set to |
Public companion properties
instance
val instance: FirebaseAI
The FirebaseAI instance for the default FirebaseApp using the Google AI Backend.
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 new GenerativeModel given the provided parameters.
| Parameters | |
|---|---|
modelName: String |
The name of the model to use. See the documentation for a list of supported models. |
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 of |
toolConfig: ToolConfig? = null |
The |
systemInstruction: Content? = null |
|
requestOptions: RequestOptions = RequestOptions() |
Configuration options for sending requests to the backend. |
| Returns | |
|---|---|
GenerativeModel |
The initialized |
imagenModel
fun imagenModel(
modelName: String,
generationConfig: ImagenGenerationConfig? = null,
safetySettings: ImagenSafetySettings? = null,
requestOptions: RequestOptions = RequestOptions()
): ImagenModel
Instantiates a new ImagenModel given the provided parameters.
| Parameters | |
|---|---|
modelName: String |
The name of the model to use. See the documentation for a list of supported models. |
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 initialized |
liveModel
@PublicPreviewAPI
fun liveModel(
modelName: String,
generationConfig: LiveGenerationConfig? = null,
tools: List<Tool>? = null,
systemInstruction: Content? = null,
requestOptions: RequestOptions = RequestOptions()
): LiveGenerativeModel
Instantiates a new LiveGenerationConfig given the provided parameters.
| Parameters | |
|---|---|
modelName: String |
The name of the model to use. See the documentation for a list of supported models. |
generationConfig: LiveGenerationConfig? = null |
The configuration parameters to use for content generation. |
tools: List<Tool>? = null |
A list of |
systemInstruction: Content? = null |
|
requestOptions: RequestOptions = RequestOptions() |
Configuration options for sending requests to the backend. |
| Returns | |
|---|---|
LiveGenerativeModel |
The initialized |
templateGenerativeModel
@PublicPreviewAPI
fun templateGenerativeModel(requestOptions: RequestOptions = RequestOptions()): TemplateGenerativeModel
Instantiates a new TemplateGenerativeModel given the provided parameters.
| Parameters | |
|---|---|
requestOptions: RequestOptions = RequestOptions() |
Configuration options for sending requests to the backend. |
| Returns | |
|---|---|
TemplateGenerativeModel |
The initialized |
templateImagenModel
@PublicPreviewAPI
fun templateImagenModel(requestOptions: RequestOptions = RequestOptions()): TemplateImagenModel
Instantiates a new TemplateImagenModel given the provided parameters.
| Parameters | |
|---|---|
requestOptions: RequestOptions = RequestOptions() |
Configuration options for sending requests to the backend. |
| Returns | |
|---|---|
TemplateImagenModel |
The initialized |