firebase_ai library
Classes
- AudioTranscriptionConfig
- The audio transcription configuration.
- AutoFunctionDeclaration
- A FunctionDeclaration for auto function calling.
- 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
Partthat represents the code execution result from the model. - Content
- The base structured datatype containing multi-part content of a message.
- ContextWindowCompressionConfig
- Enables context window compression to manage the model's context window.
- CountTokensResponse
- Response for Count Tokens
- ExecutableCodePart
-
A
Partthat 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
FunctionCallreturned from the model that contains a string representing theFunctionDeclaration.namewith 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).
- GoingAwayNotice
- A server message indicating that the server will not be able to service the client soon.
- GoogleMaps
- A tool that allows a Gemini model to connect to Google Maps to access and incorporate location-based information into its responses.
- GoogleMapsGroundingChunk
- A grounding chunk sourced from Google Maps.
- 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.
- GroundingChunk
- Represents a chunk of retrieved data that supports a claim in the model's response.
- ImageConfig
- Configuration options for generating images with Gemini models.
- 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.
- JSONSchema
- The definition of a JSON Schema data type.
- LatLng
- An object that represents a latitude/longitude pair.
- 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.
- RetrievalConfig
- The configuration that specifies information which can be used by tools during inference calls.
- 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.
- SessionResumptionConfig
- Configuration for the session resumption mechanism.
- SessionResumptionUpdate
- An update of the session resumption state.
- SlidingWindow
- Configures the sliding window context compression mechanism.
- SpeechConfig
- Configures speech synthesis settings.
- TemplateAutoFunctionDeclaration
- A function declaration for a template tool that can be called by the model.
- TemplateChatSession
- A back-and-forth chat with a server template.
- TemplateFunctionDeclaration
- A function declaration for a template tool.
- TemplateGenerativeModel
- A generative model that connects to a remote server template.
- TemplateImagenModel
- An image model that connects to a remote server template.
- TemplateTool
- A collection of template tools.
- TemplateToolConfig
- Config for template tools to use with server prompts.
- 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.
- Transcription
- Audio transcription message.
- 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.
- WebGroundingChunk
- A grounding chunk sourced from the web.
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.
- ImageAspectRatio
- An aspect ratio for generated images.
- 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.
- ImageSize
- The size of images to generate.
- ResponseModalities
- The available response modalities.
- SchemaType
- The value type of a Schema.
- ThinkingLevel
- A preset that balances the trade-off between reasoning quality and response speed for a model's "thinking" process.
Extensions
- StartChatExtension on GenerativeModel
- StartChatExtension on GenerativeModel
- StartTemplateChatExtension on TemplateGenerativeModel
-
An extension on TemplateGenerativeModel that provides a
startChatmethod.
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.
- QuotaExceeded
- Exception thrown when the quota is exceeded.
- ServerException
- Exception thrown when the server failed to generate content.
- ServiceApiNotEnabled
- Exception thrown when the service API is not enabled.
- UnsupportedUserLocation
- Exception thrown when the user location is unsupported.