Firebase.AI.FirebaseAI

The entry point for all FirebaseAI SDK functionality.

Summary

Properties

DefaultInstance
static FirebaseAI
Returns a FirebaseAI instance with the default FirebaseApp and GoogleAI Backend.

Public static functions

GetInstance(Backend? backend)
Returns a FirebaseAI instance with the default FirebaseApp and the given Backend.
GetInstance(FirebaseApp app, Backend? backend)
Returns a FirebaseAI instance with the given FirebaseApp and Backend.

Public functions

GetGenerativeModel(string modelName, GenerationConfig? generationConfig, SafetySetting[] safetySettings, Tool[] tools, ToolConfig? toolConfig, ModelContent? systemInstruction, RequestOptions? requestOptions)
Initializes a generative model with the given parameters.
GetLiveModel(string modelName, LiveGenerationConfig? liveGenerationConfig, Tool[] tools, ModelContent? systemInstruction, RequestOptions? requestOptions)
Initializes a LiveGenerativeModel for real-time interaction.

Structs

Firebase.AI.FirebaseAI.Backend

Defines which backend AI service is being used, provided to FirebaseAI.GetInstance.

Properties

DefaultInstance

static FirebaseAI DefaultInstance

Returns a FirebaseAI instance with the default FirebaseApp and GoogleAI Backend.

Public static functions

GetInstance

FirebaseAI GetInstance(
  Backend? backend
)

Returns a FirebaseAI instance with the default FirebaseApp and the given Backend.

Details
Parameters
backend
The backend AI service to use.
Returns
A configured instance of FirebaseAI.

GetInstance

FirebaseAI GetInstance(
  FirebaseApp app,
  Backend? backend
)

Returns a FirebaseAI instance with the given FirebaseApp and Backend.

Details
Parameters
app
The custom FirebaseApp used for initialization.
backend
The backend AI service to use.
Returns
A configured instance of FirebaseAI.

Public functions

GetGenerativeModel

GenerativeModel GetGenerativeModel(
  string modelName,
  GenerationConfig? generationConfig,
  SafetySetting[] safetySettings,
  Tool[] tools,
  ToolConfig? toolConfig,
  ModelContent? systemInstruction,
  RequestOptions? requestOptions
)

Initializes a generative model with the given parameters.

  • Note: Refer to Gemini models for guidance on choosing an appropriate model for your use case.

Details
Parameters
modelName
The name of the model to use, for example "gemini-2.0-flash"; see available model names for a list of supported model names.
generationConfig
The content generation parameters your model should use.
safetySettings
A value describing what types of harmful content your model should allow.
tools
A list of Tool objects that the model may use to generate the next response.
toolConfig
Tool configuration for any Tool specified in the request.
systemInstruction
Instructions that direct the model to behave a certain way; currently only text content is supported.
requestOptions
Configuration parameters for sending requests to the backend.
Returns
The initialized GenerativeModel instance.

GetLiveModel

LiveGenerativeModel GetLiveModel(
  string modelName,
  LiveGenerationConfig? liveGenerationConfig,
  Tool[] tools,
  ModelContent? systemInstruction,
  RequestOptions? requestOptions
)

Initializes a LiveGenerativeModel for real-time interaction.

  • Note: Refer to Gemini models for guidance on choosing an appropriate model for your use case.
  • Note: Currently only supports the VertexAI backend.

Details
Parameters
modelName
The name of the model to use, for example "gemini-2.0-flash-live-preview-04-09"; see available model names for a list of supported model names.
liveGenerationConfig
The content generation parameters your model should use.
tools
A list of Tool objects that the model may use to generate the next response.
systemInstruction
Instructions that direct the model to behave a certain way.
requestOptions
Configuration parameters for sending requests to the backend.
Returns
The initialized LiveGenerativeModel instance.