Package-level declarations

Types

Link copied to clipboard

Configures the model's automatic detection of user activity.

Link copied to clipboard

The Firebase project has not been configured and enabled for the selected API.

Link copied to clipboard

Represents the aspect ratio that the generated image should conform to.

Link copied to clipboard

Audio record initialization failures for audio streaming

Link copied to clipboard

The audio transcription configuration. Its presence enables audio transcription

Link copied to clipboard

Defines a function that the model can use as a tool. Including a function references to enable automatic function calling.

Link copied to clipboard

Describes why content was blocked.

Link copied to clipboard
class Candidate

A Candidate represents a single response generated by the model for a given request.

Link copied to clipboard
class Citation

Represents a citation of content from an external source within the model's output.

Link copied to clipboard

A collection of source attributions for a piece of content.

Link copied to clipboard

Represents the code execution result from the model.

Link copied to clipboard
class Content @JvmOverloads constructor(val role: String? = "user", val parts: List<Part>)

Represents content sent to and received from the model.

Link copied to clipboard

Content part modality.

Link copied to clipboard
class ContextWindowCompressionConfig(val triggerTokens: Int? = null, val slidingWindow: SlidingWindow? = null)

Enables context window compression to manage the model's context window.

Link copied to clipboard

The model's response to a count tokens request.

Link copied to clipboard

Represents the code that was executed by the model.

Link copied to clipboard

Represents file data stored in Cloud Storage for Firebase, referenced by URI.

Link copied to clipboard

Represents the reason why the model stopped generating content.

Link copied to clipboard

Parent class for any errors that occur from the FirebaseAI SDK.

The parameters used in the request are not valid.

Link copied to clipboard

An operation has been requested, but device doesn't support local models, or they are not available.

Link copied to clipboard

Catch all case for exceptions not explicitly expected.

Link copied to clipboard

Thrown when a function invoked by the model has an error that should be returned to the model

Link copied to clipboard

The configuration that specifies the function calling behavior.

Link copied to clipboard

Represents function call name and params received from requests.

Link copied to clipboard
class FunctionDeclaration(name: String, description: String, parameters: Map<String, Schema>, optionalParameters: List<String> = emptyList())

Defines a function that the model can use as a tool.

Link copied to clipboard

Represents function call output to be returned to the model when it requests a function call.

Link copied to clipboard

A response from the model.

Link copied to clipboard

A GenerateContentResponse augmented with class information.

Link copied to clipboard

Configuration parameters to use for content generation.

Link copied to clipboard

Represents a reference to a backend for generative AI.

Link copied to clipboard

A tool that allows a Gemini model to connect to Google Maps to access and incorporate location-based information into its responses.

Link copied to clipboard

A grounding chunk from Google Maps.

Link copied to clipboard

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.

Link copied to clipboard

Represents a chunk of retrieved data that supports a claim in the model's response.

Link copied to clipboard

Metadata returned to the client when grounding is enabled.

Link copied to clipboard

Provides information about how a specific segment of the model's response is supported by the retrieved grounding chunks.

Link copied to clipboard

Specifies how the block method computes the score that will be compared against the HarmBlockThreshold in SafetySetting.

Link copied to clipboard

Represents the threshold for a HarmCategory to be allowed by SafetySetting.

Link copied to clipboard

Category for a given harm rating.

Link copied to clipboard

Represents the probability that some HarmCategory is applicable in a SafetyRating.

Link copied to clipboard

Represents the severity of a HarmCategory being applicable in a SafetyRating.

Link copied to clipboard

Configuration options for generating images with Gemini models.

Link copied to clipboard
class ImagePart : Part

Represents image data sent to and received from requests. The image is converted client-side to JPEG encoding at 80% quality before being sent to the server.

Link copied to clipboard
class ImageSize

The size of images to generate.

Link copied to clipboard
class InlineData(val data: ByteArray, val mimeType: String, val displayName: String?)

Represents binary data with an associated MIME type.

Link copied to clipboard

Represents binary data with an associated MIME type sent to and received from requests.

Link copied to clipboard

The provided API Key is not valid.

Link copied to clipboard

The specified Agent Platform location is invalid.

Link copied to clipboard

Some form of state occurred that shouldn't have.

Link copied to clipboard
class JsonSchema<T : Any>

Definition of a data type.

Link copied to clipboard
data class LatLng(val latitude: Double, val longitude: Double)

An object that represents a latitude/longitude pair.

Link copied to clipboard

Configuration parameters to use for conversation config.

Link copied to clipboard

Configuration parameters to use for live content generation.

Link copied to clipboard

Incremental server update generated by the model in response to client messages.

Link copied to clipboard

Notification that the server is initiating a disconnect of the session.

Link copied to clipboard

Parent interface for responses from the model during live interactions.

Link copied to clipboard

The model is ready to receive client messages.

Link copied to clipboard

Request for the client to execute the provided functionCalls.

Link copied to clipboard

Notification for the client to cancel a previous function call from LiveServerToolCall.

Link copied to clipboard

A message from the server that this version of the SDK does not know.

Link copied to clipboard
actual class LiveSession

Represents a live WebSocket session capable of streaming content to and from the server.

expect class LiveSession

Represents a live WebSocket session capable of streaming content to and from the server.

actual class LiveSession

A Live API session of the platform SDK. The messages of the server are buffered from the moment the session opens until they are received. resumeSession opens a new session of the platform SDK and closes the current one, as the Android SDK does.

Link copied to clipboard

An update of the session resumption state.

Link copied to clipboard

Represents token counting info for a single modality.

Link copied to clipboard
class MultiSpeakerVoiceConfig(val speakerVoiceConfigs: List<SpeakerVoiceConfig>)

Configuration for a multi-speaker audio generation setup.

Link copied to clipboard
interface Part

Interface representing data sent to and received from requests.

Link copied to clipboard

The request is missing a permission that is required to perform the requested operation.

Link copied to clipboard

A request was blocked.

Link copied to clipboard

Feedback on the prompt provided in the request.

Link copied to clipboard
@RequiresOptIn(level = RequiresOptIn.Level.ERROR, message = "This API is part of an experimental public preview and may change in backwards-incompatible ways without notice.")
annotation class PublicPreviewAPI
Link copied to clipboard

The request has hit a quota limit. Learn more about quotas in the Firebase documentation.

Link copied to clipboard

Configures model input behavior when generating content in the Live API via realtime supported methods.

Link copied to clipboard

Configurable options unique to how requests to the backend are performed.

Link copied to clipboard

Factory for creating RequestOptions with custom configurations. This is primarily intended for use by wrapper libraries and internal tools.

Link copied to clipboard

A request took too long to complete.

Link copied to clipboard

Represents the type of content present in a response (for example, text, image, audio).

Link copied to clipboard

A request was stopped during generation for some reason.

Link copied to clipboard

The configuration that specifies information which can be used by tools during inference calls.

Link copied to clipboard

An assessment of the potential harm of some generated content.

Link copied to clipboard
class SafetySetting(harmCategory: HarmCategory, threshold: HarmBlockThreshold, method: HarmBlockMethod? = null)

A configuration for a HarmBlockThreshold of some HarmCategory allowed and blocked in responses.

Link copied to clipboard
class Schema

Definition of a data type.

Link copied to clipboard

Represents a Google Search entry point.

Link copied to clipboard
class Segment

Represents a specific segment within a Content object, often used to pinpoint the exact location of text or data that grounding information refers to.

Link copied to clipboard

Something went wrong while trying to deserialize a response from the server.

Link copied to clipboard

The server responded with a non 200 response code.

Handshake failed with the server

Link copied to clipboard

The service is not enabled for this Firebase project. Learn how to enable the required services in the Firebase documentation.

Link copied to clipboard

Streaming session already receiving.

Link copied to clipboard

Configuration for the session resumption mechanism.

Link copied to clipboard
class SlidingWindow(val targetTokens: Int? = null)

Configures the sliding window context compression mechanism.

Link copied to clipboard
class SpeakerVoiceConfig(val speaker: String, val voice: Voice)

Configures a speaker with a unique name/identifier and a specific voice.

Link copied to clipboard

Speech configuration class for controlling the model's speech and audio generation behaviors.

Link copied to clipboard
class SpeechMetadata @JvmOverloads constructor(val speaker: String? = null, val style: String? = null)

How the text of a TextPart is spoken when the model generates speech from it.

Link copied to clipboard
abstract class StringFormat
Link copied to clipboard

A function declaration for a template tool that can be called by the model automatically.

Link copied to clipboard
open class TemplateFunctionDeclaration(val name: String, val inputSchema: JsonSchema<out Any>? = null, val outputSchema: JsonSchema<out Any>? = null)

A function declaration for a template tool.

Link copied to clipboard

Contains a set of tools (like function declarations) that the server template model has access to.

Link copied to clipboard
class TemplateToolConfig(retrievalConfig: RetrievalConfig?)

Config for template tools to use with server prompts.

Link copied to clipboard
class TextPart : Part

Represents text or string based data sent to and received from requests.

Link copied to clipboard

Gemini 2.5 series models and newer utilize a thinking process before generating a response. This allows them to reason through complex problems and plan a more coherent and accurate answer. See the thinking documentation for more details.

Link copied to clipboard

Specifies the quality of the thinking response.

Link copied to clipboard
class Tool

Contains a set of tools (like function declarations) that the model has access to. These tools can be used to gather information or complete tasks.

Link copied to clipboard
class ToolConfig @JvmOverloads constructor(functionCallingConfig: FunctionCallingConfig? = null, retrievalConfig: RetrievalConfig? = null)

Contains configuration for the function calling tools of the model. This can be used to change when the model can predict function calls.

Link copied to clipboard

Audio transcription message.

Link copied to clipboard

Catch all case for exceptions not explicitly expected.

Link copied to clipboard

The user's location (region) is not supported by the API.

Link copied to clipboard

Specifies the URL context configuration.

Link copied to clipboard

Metadata related to the UrlContext tool.

Link copied to clipboard

Metadata for a single URL retrieved by the UrlContext tool.

Link copied to clipboard

The status of a URL retrieval.

Link copied to clipboard

Usage metadata about response(s).

Link copied to clipboard
class Voice(val voiceName: String)

Various voices supported by the server. See the list of supported voices

Link copied to clipboard

A grounding chunk from the web.

Functions

Link copied to clipboard

Helper method to construct an ActivityDetectionConfig in a DSL-like manner.

Link copied to clipboard

Returns the part as a FileDataPart if it represents a file, and null otherwise

Link copied to clipboard

Returns the part as a InlineDataPart if it represents inline data, and null otherwise

Link copied to clipboard

Returns the part as a String if it represents text, and null otherwise

Link copied to clipboard
fun content(role: String? = "user", init: Content.Builder.() -> Unit): Content

Function to build a new Content instances in a DSL-like manner.

Link copied to clipboard

Helper method to construct a GenerationConfig in a DSL-like manner.

Link copied to clipboard

Helper method to construct an ImageConfig in a DSL-like manner.

Link copied to clipboard
Link copied to clipboard

Helper method to construct a LiveGenerationConfig in a DSL-like manner.

Link copied to clipboard

Helper method to construct a RealtimeInputConfig in a DSL-like manner.

Link copied to clipboard

Helper method to construct a RetrievalConfig in a DSL-like manner.

Link copied to clipboard

Helper method to construct a ThinkingConfig in a DSL-like manner.