firebase_ai library
Classes
- Candidate
- Response candidate generated from a GenerativeModel.
- ChatSession
- A back-and-forth chat with a generative model.
- Citation
- Citation to a source for a portion of a specific response.
- CitationMetadata
- Source attributions for a piece of content.
- CodeExecution
- A tool that allows the model to use Code Execution.
- CodeExecutionResultPart
-
A
Part
that represents the code execution result from the model. - Content
- The base structured datatype containing multi-part content of a message.
- CountTokensResponse
- Response for Count Tokens
- ExecutableCodePart
-
A
Part
that represents the code that is executed by the model. - FileData
- A Part with Firebase Storage uri as prompt content
- FirebaseAI
- The entrypoint for generative models.
- FunctionCall
-
A predicted
FunctionCall
returned from the model that contains a string representing theFunctionDeclaration.name
with the arguments and their values. - FunctionCallingConfig
- Configuration specifying how the model should use the functions provided as tools.
- FunctionDeclaration
- Structured representation of a function declaration as defined by the OpenAPI 3.03 specification.
- FunctionResponse
- The response class for FunctionCall
- GenerateContentResponse
- Response from the model; supports multiple candidates.
- GenerationConfig
- Configuration options for model generation and outputs.
- GenerativeModel
- A multimodel generative model (like Gemini).
- GoogleSearch
- A tool that allows the generative model to connect to Google Search to access and incorporate up-to-date information from the web into its responses.
- ImagenBackgroundMask
- A background mask.
- ImagenControlConfig
- The configuration for the control.
- ImagenControlReference
- A control reference.
- ImagenDimensions
- The dimensions of an image.
- ImagenEditingConfig
- The configuration for image editing.
- ImagenForegroundMask
- A foreground mask.
- ImagenFormat
- Represents the image format and compression quality.
- ImagenGenerationConfig
- Configuration options for image generation.
- ImagenImagePlacement
- The placement of an image.
- ImagenInlineImage
- Represents an image stored as a base64-encoded string.
- ImagenMaskConfig
- The configuration for the mask.
- ImagenMaskReference
- A reference image that is a mask.
- ImagenModel
- Represents a remote Imagen model with the ability to generate images using text prompts.
- ImagenRawImage
- A raw image.
- ImagenRawMask
- A raw mask.
- ImagenReferenceImage
- A reference image for image editing.
- ImagenSafetySettings
- A class representing safety settings for image generation.
- ImagenSemanticMask
- A semantic mask.
- ImagenStyleConfig
- The configuration for the style.
- ImagenStyleReference
- A style reference.
- ImagenSubjectConfig
- The configuration for the subject.
- ImagenSubjectReference
- A subject reference.
- InlineDataPart
- A Part with the byte content of a file.
- LiveGenerationConfig
- Configures live generation settings.
- LiveGenerativeModel
- A live, generative AI model for real-time interaction.
- LiveServerContent
- Content generated by the model in a live stream.
- LiveServerMessage
- An abstract class representing a message received from a live server.
- LiveServerResponse
- A single response chunk received during a live content generation.
- LiveServerToolCall
- A tool call in a live stream.
- LiveServerToolCallCancellation
- A tool call cancellation in a live stream.
- LiveSession
- Manages asynchronous communication with Gemini model over a WebSocket connection.
- Part
- A datatype containing media that is part of a multi-part Content message.
- PromptFeedback
- Feedback metadata of a prompt specified in a GenerativeModel request.
- SafetyRating
- Safety rating for a piece of content.
- SafetySetting
- Safety setting, affecting the safety-blocking behavior.
- Schema
- The definition of an input or output data types.
- SpeechConfig
- Configures speech synthesis settings.
- TextPart
- A Part with the text content.
- ThinkingConfig
- Config for thinking features.
- Tool
- Tool details that the model may use to generate a response.
- ToolConfig
- Config for tools to use with model.
- UnknownPart
- A Part that contains unparsable data.
- UrlContext
- A tool that allows you to provide additional context to the models in the form of public web URLs. By including URLs in your request, the Gemini model will access the content from those pages to inform and enhance its response.
- UsageMetadata
- Metadata on the generation request's token usage.
Enums
- BlockReason
- The reason why a prompt was blocked.
- FinishReason
- Reason why a model stopped generating tokens.
- FunctionCallingMode
- The mode in which the model should use the functions provided as tools.
- HarmBlockMethod
- Specifies how the block method computes the score that will be compared against the HarmBlockThreshold in SafetySetting.
- HarmBlockThreshold
- Probability of harm which causes content to be blocked.
- HarmCategory
- The category of a rating.
- HarmProbability
- The probability that a piece of content is harmful.
- ImagenAspectRatio
- The aspect ratio for the image.
- ImagenControlType
- The type of control image.
- ImagenEditMode
- The desired outcome of the image editing.
- ImagenMaskMode
- The mode of the mask.
- ImagenPersonFilterLevel
- Allow generation of people by the model.
- ImagenSafetyFilterLevel
- Specifies the level of safety filtering for image generation.
- ImagenSubjectReferenceType
- The type of the subject in the image.
- ResponseModalities
- The available response modalities.
- SchemaType
- The value type of a Schema.
Extensions
Exceptions / Errors
- FirebaseAIException
- Exception thrown when generating content fails.
- FirebaseAISdkException
- Exception indicating a stale package version or implementation bug.
- InvalidApiKey
- Exception thrown when the server rejects the API key.
- ServerException
- Exception thrown when the server failed to generate content.
- UnsupportedUserLocation
- Exception thrown when the user location is unsupported.