Firebase.AI

Summary

Enumerations

BlockReason{
  Unknown = 0,
  Safety,
  Other,
  Blocklist,
  ProhibitedContent
}
enum
A type describing possible reasons to block a prompt.
ContentModality{
  Unknown = 0,
  Text,
  Image,
  Video,
  Audio,
  Document
}
enum
Content part modality.
FinishReason{
  Unknown = 0,
  Stop,
  MaxTokens,
  Safety,
  Recitation,
  Other,
  Blocklist,
  ProhibitedContent,
  SPII,
  MalformedFunctionCall
}
enum
Represents the reason why the model stopped generating content.
HarmCategory{
  Unknown = 0,
  Harassment,
  HateSpeech,
  SexuallyExplicit,
  DangerousContent,
  CivicIntegrity
}
enum
Categories describing the potential harm a piece of content may pose.
ResponseModality{
  Text,
  Image,
  Audio
}
enum
The response type the model should return with.

Classes

Firebase.AI.Chat

An object that represents a back-and-forth chat with a model, capturing the history and saving the context in memory between each message sent.

Firebase.AI.FirebaseAI

The entry point for all FirebaseAI SDK functionality.

Firebase.AI.GenerativeModel

A type that represents a remote multimodal model (like Gemini), with the ability to generate content based on various input types.

Firebase.AI.LiveGenerativeModel

A live, generative AI model for real-time interaction.

Firebase.AI.LiveSession

Manages asynchronous communication with Gemini model over a WebSocket connection.

Firebase.AI.Schema

A Schema object allows the definition of input and output data types.

Structs

Firebase.AI.Candidate

A struct representing a possible reply to a content generation prompt.

Firebase.AI.Citation

A struct describing a source attribution.

Firebase.AI.CitationMetadata

A collection of source attributions for a piece of content.

Firebase.AI.CountTokensResponse

The model's response to a count tokens request.

Firebase.AI.FunctionCallingConfig

Configuration for specifying function calling behavior.

Firebase.AI.FunctionDeclaration

Structured representation of a function declaration.

Firebase.AI.GenerateContentResponse

The model's response to a generate content request.

Firebase.AI.GenerationConfig

A struct defining model parameters to be used when sending generative AI requests to the backend model.

Firebase.AI.LiveGenerationConfig

A struct defining model parameters to be used when generating live session content.

Firebase.AI.LiveSessionContent

Content generated by the model in a live session.

Firebase.AI.LiveSessionResponse

Represents the response from the model for live content updates.

Firebase.AI.LiveSessionToolCall

A request to use a tool from the live session.

Firebase.AI.LiveSessionToolCallCancellation

A request to cancel using a tool from the live session.

Firebase.AI.ModalityTokenCount

Represents token counting info for a single modality.

Firebase.AI.ModelContent

A type describing data in media formats interpretable by an AI model.

Firebase.AI.PromptFeedback

A metadata struct containing any feedback the model had on the prompt it was provided.

Firebase.AI.RequestOptions

Configuration parameters for sending requests to the backend.

Firebase.AI.SafetyRating

A type defining potentially harmful media categories and their model-assigned ratings.

Firebase.AI.SafetySetting

A type used to specify a threshold for harmful content, beyond which the model will return a fallback response instead of generated content.

Firebase.AI.SpeechConfig

A struct used to configure speech generation settings.

Firebase.AI.Tool

A helper tool that the model may use when generating responses.

Firebase.AI.ToolConfig

Tool configuration for any Tool specified in the request.

Firebase.AI.UsageMetadata

Token usage metadata for processing the generate content request.

Interfaces

Firebase.AI.ILiveSessionMessage

Represents a message received from a live session.

Enumerations

BlockReason

 BlockReason

A type describing possible reasons to block a prompt.

Properties
Blocklist

The prompt was blocked because it contained terms from the terminology blocklist.

Other

All other block reasons.

ProhibitedContent

The prompt was blocked due to prohibited content.

Safety

The prompt was blocked because it was deemed unsafe.

Unknown

A new and not yet supported value.

ContentModality

 ContentModality

Content part modality.

Properties
Audio

Audio.

Document

Document, e.g.

PDF.

Image

Image.

Text

Plain text.

Unknown

A new and not yet supported value.

Video

Video.

FinishReason

 FinishReason

Represents the reason why the model stopped generating content.

Properties
Blocklist

Token generation was stopped because the response contained forbidden terms.

MalformedFunctionCall

Token generation was stopped because the function call generated by the model was invalid.

MaxTokens

The maximum number of tokens as specified in the request was reached.

Other

All other reasons that stopped token generation.

ProhibitedContent

Token generation was stopped because the response contained potentially prohibited content.

Recitation

The token generation was stopped because the response was flagged for unauthorized citations.

SPII

Token generation was stopped because of Sensitive Personally Identifiable Information (SPII).

Safety

The token generation was stopped because the response was flagged for safety reasons.

Stop

Natural stop point of the model or provided stop sequence.

Unknown

A new and not yet supported value.

HarmCategory

 HarmCategory

Categories describing the potential harm a piece of content may pose.

Properties
CivicIntegrity

Content that may be used to harm civic integrity.

DangerousContent

Promotes or enables access to harmful goods, services, or activities.

Harassment

Harassment content.

HateSpeech

Negative or harmful comments targeting identity and/or protected attributes.

SexuallyExplicit

Contains references to sexual acts or other lewd content.

Unknown

A new and not yet supported value.

ResponseModality

 ResponseModality

The response type the model should return with.

Properties
Audio

Public Experimental: Specifies that the model should generate audio data.

Use this modality with a LiveGenerationConfig to create audio content based on the provided input or prompts with a LiveGenerativeModel.

Image

Public Experimental: Specifies that the model should generate image data.

Use this modality when you want the model to create visual content based on the provided input or prompts. The response might contain one or more generated images. See the image generation documentation for more details.

Warning: Image generation using Gemini 2.0 Flash is a Public Experimental feature, which means that it is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways.

Text

Specifies that the model should generate textual content.

Use this modality when you need the model to produce written language, such as answers to questions, summaries, creative writing, code snippets, or structured data formats like JSON.