googleai_dart library

Unofficial Dart client for the Google AI Gemini Developer API and Vertex AI Gemini API with unified interface.

Note: Google's "Vertex AI name changes" list several Vertex AI products and features (e.g. Vertex AI Platform, Generative AI on Vertex AI) under the Gemini Enterprise Agent Platform brand. The API and SDKs still use the Vertex AI name, so this library keeps it (e.g. GoogleAIConfig.vertexAI(...)), matching Google's REST API and official SDKs. See the Vertex AI name changes.

Classes

Agent
A reusable agent definition for the Interactions API.
AgentConfig
Base class for agent configurations.
AllowedTools
Configuration for allowed tools.
AllowlistEntry
A single allowed outbound domain in an environment's network egress configuration.
Annotation
Citation information for model-generated content.
ApiKeyCredentials
API key authentication credentials.
ApiKeyProvider
Simple API key provider with static credentials.
ArgumentsDelta
An arguments delta update.
AttributionSourceId
Identifier for the source contributing to this attribution.
AudioContent
An audio content block.
AudioDelta
An audio delta update.
AudioResponseFormat
Configuration for audio output format.
AudioTranscriptionConfig
Configuration for audio transcription.
AuthCredentials
Authentication credentials returned by AuthProvider.
AuthProvider
Authentication provider interface for the GoogleAI client.
AuthToken
Ephemeral authentication token for secure client-side API access.
AutomaticActivityDetection
Configuration for automatic voice activity detection (VAD).
BatchEmbedContentsRequest
Batch request to get embeddings from the model for a list of prompts.
BatchEmbedContentsResponse
The response to a BatchEmbedContentsRequest.
BatchStats
Stats about a batch operation.
BearerTokenCredentials
Bearer token authentication credentials.
BearerTokenProvider
Simple bearer token provider with static credentials.
BidiGenerateContentClientContent
Client content message for sending conversation context.
BidiGenerateContentClientMessage
Base class for client-to-server WebSocket messages.
BidiGenerateContentRealtimeInput
Real-time input message for streaming audio, video, or text.
BidiGenerateContentServerContent
Server content message containing model output.
BidiGenerateContentServerMessage
Base class for server-to-client WebSocket messages.
BidiGenerateContentSetup
Initial session setup message.
BidiGenerateContentSetupComplete
Session setup complete message.
BidiGenerateContentToolCall
Tool call request message.
BidiGenerateContentToolCallCancellation
Tool call cancellation message.
BidiGenerateContentToolResponse
Tool response message.
Blob
Inline binary data (e.g., image, audio) encoded as base64.
CachedContent
Cached content for reuse across requests.
CachedContentUsageMetadata
Usage metadata for cached content.
Candidate
A generated response from the model.
ChunkingConfig
Parameters for telling the service how to chunk the file.
CitationMetadata
Citation sources for generated content.
CitationSource
A citation source.
CodeExecution
Tool that enables code execution capability.
CodeExecutionCallDelta
A streamed delta for a code execution tool call.
CodeExecutionCallStep
A code execution tool call step.
CodeExecutionCallStepArguments
The arguments to pass to the code execution tool.
CodeExecutionResult
Result of executing the ExecutableCode.
CodeExecutionResultDelta
A streamed delta for a code execution result.
CodeExecutionResultPart
Result from code execution.
CodeExecutionResultStep
Result of a code execution call.
CodeExecutionTool
A tool that allows the model to execute code.
ComputerUse
Computer Use tool type.
ComputerUseTool
A tool that allows the model to interact with the computer.
Condition
Filter condition applicable to a single key.
Content
Represents a message in a conversation (user or model turn).
ContentEmbedding
An embedding for a piece of content.
ContentListInput
A list of InteractionContent items as input.
ContextWindowCompressionConfig
Configuration for context window compression.
Corpus
A collection of Documents.
CountTokensRequest
Request to count tokens.
CountTokensResponse
Response from counting tokens.
CreateAgentInteractionParams
Parameters for creating an interaction with an agent.
CreateAuthTokenRequest
Request wrapper for creating an ephemeral authentication token.
CreateModelInteractionParams
Parameters for creating an interaction with a model.
Dataset
Reference to a training dataset.
DeepResearchAgentConfig
Configuration for the Deep Research agent.
Document
A collection of related content in a corpus.
DocumentContent
A document content block.
DocumentDelta
A document delta update.
DynamicAgentConfig
Configuration for dynamic agents.
DynamicRetrievalConfig
Describes the options to customize dynamic retrieval.
EmbedContentBatch
A resource representing a batch of EmbedContent requests.
EmbedContentBatchOutput
The output of an EmbedContent batch request.
EmbedContentBatchStats
Stats about an embed batch operation.
EmbedContentConfig
Configuration for the EmbedContent request.
EmbedContentRequest
Request to embed content.
EmbedContentResponse
Response from embedding content.
EmbeddingUsageMetadata
Metadata on the usage of the embedding request.
EnvironmentConfig
Configuration for a remote environment (sandbox) for an interaction or agent.
EnvironmentConfigOrId
The environment value for an interaction or agent.
EnvironmentIdRef
A string reference to an environment — an existing environment id, or a literal such as "remote".
EnvironmentNetworkAllowlist
An allowlist restricting which external domains the sandbox can reach.
EnvironmentNetworkDisabled
Disables all network egress for the sandbox (the "disabled" form).
EnvironmentNetworkEgressAllowlist
Outbound networking configuration for an environment's sandbox.
EphemeralTokenCredentials
Ephemeral token authentication credentials.
EphemeralTokenProvider
Provider for ephemeral token authentication.
ErrorEvent
An event indicating that an error has occurred.
ExaAISearchConfig
Configuration for ExaAISearch.
ExecutableCode
Code generated by the model that is meant to be executed.
ExecutableCodePart
Code for model to execute.
File
Represents an uploaded file.
FileCitation
A file citation annotation.
FileData
Reference to an uploaded file (via /v1beta/files).
FileDataPart
Reference to uploaded file.
FileSearch
The FileSearch tool that retrieves knowledge from Semantic Retrieval corpora.
FileSearchCallDelta
A streamed delta for a file search tool call.
FileSearchCallStep
A File Search tool call step.
FileSearchCustomMetadata
User-provided custom metadata stored as key-value pairs for file search.
FileSearchResultDelta
A streamed delta for a file search result.
FileSearchResultStep
Result of a File Search call.
FileSearchStore
A FileSearchStore is a collection of Documents.
FileSearchTool
A tool that allows the model to search files.
Filter
Filter config for a Rag retrieval.
FunctionCall
A predicted function call returned from the model.
FunctionCallingConfig
Configuration for specifying function calling behavior.
FunctionCallPart
Model's request to call a function.
FunctionCallStep
A function tool call step.
FunctionDeclaration
Structured representation of a function declaration.
FunctionResponse
The result output from a function call.
FunctionResponseBlob
Raw media bytes for function response.
FunctionResponseInlinePart
A datatype containing media that is part of a FunctionResponse message.
FunctionResponsePart
Result from function execution.
FunctionResultDelta
A streamed delta for a function tool result.
FunctionResultStep
Result of a function tool call.
FunctionResultSubcontent
A subcontent item within a function or MCP server tool result.
FunctionResultSubcontentImage
An ImageContent used as function result subcontent.
FunctionResultSubcontentText
A TextContent used as function result subcontent.
FunctionTool
A function tool that can be called by the model.
GenerateAnswerRequest
Request to generate a grounded answer from the Model.
GenerateAnswerResponse
Response from the model for a grounded answer.
GenerateContentBatch
A resource representing a batch of GenerateContent requests.
GenerateContentBatchOutput
The output of a GenerateContent batch request.
GenerateContentRequest
Request to generate content.
GenerateContentResponse
Response from generating content.
GeneratedFile
A file generated on behalf of a user (e.g., video generated by Veo).
GenerationConfig
Configuration options for model generation.
GoAway
Go away message indicating session is ending.
GoogleAIClient
Main client for the GoogleAI API.
GoogleAIConfig
Configuration for the GoogleAI client.
GoogleMaps
The GoogleMaps Tool that provides geospatial context for the user's query.
GoogleMapsCallDelta
A streamed delta for a Google Maps tool call.
GoogleMapsCallStep
A Google Maps tool call step.
GoogleMapsCallStepArguments
The arguments to pass to the Google Maps tool.
GoogleMapsResultDelta
A streamed delta for a Google Maps result.
GoogleMapsResultItem
A single item from a Google Maps query result.
GoogleMapsResultPlaces
A place returned in a GoogleMapsResultItem.
GoogleMapsResultStep
Result of a Google Maps call.
GoogleMapsTool
A tool that allows the model to use Google Maps.
GoogleSearch
Google Search tool configuration.
GoogleSearchCallDelta
A streamed delta for a Google Search tool call.
GoogleSearchCallStep
A Google Search tool call step.
GoogleSearchCallStepArguments
The arguments to pass to Google Search.
GoogleSearchResultDelta
A streamed delta for a Google Search result.
GoogleSearchResultItem
A single result from a Google Search.
GoogleSearchResultStep
Result of a Google Search call.
GoogleSearchRetrieval
Tool to retrieve public web data for grounding, powered by Google.
GoogleSearchTool
A tool that allows the model to search Google.
GroundingAttribution
Attribution for a source that contributed to an answer.
GroundingChunk
Grounding chunk.
GroundingChunkCustomMetadata
Custom metadata associated with a grounding chunk.
GroundingChunkStringList
A list of strings associated with a grounding chunk.
GroundingMetadata
Metadata returned to client when grounding is enabled.
GroundingPassage
Passage included inline with a grounding configuration.
GroundingPassageId
Identifier for a passage within a GroundingPassage.
GroundingPassages
A repeated list of passages.
GroundingSupport
Grounding support.
GroundingToolCount
The number of grounding tool counts.
HybridSearch
Config for Hybrid Search.
Hyperparameters
Hyperparameters for tuning a model.
Image
An image result from a web search.
ImageConfig
Config for image generation features.
ImageContent
An image content block.
ImageDelta
An image delta update.
ImageResponseFormat
Configuration for image output format.
ImageSearch
Image search configuration.
ImportFileRequest
Request for ImportFile to import a File API file with a FileSearchStore.
ImportFileResponse
Response for ImportFile to import a File API file with a FileSearchStore.
InlineDataPart
Inline binary data (base64).
InlinedEmbedContentRequest
A single embed request in a batch with optional metadata.
InlinedEmbedContentRequests
A list of inlined embed requests for batch processing.
InlinedEmbedContentResponse
A single embed response in a batch with optional metadata and error.
InlinedEmbedContentResponses
A list of inlined embed responses from batch processing.
InlinedRequest
A single request in a batch with optional metadata.
InlinedRequests
A list of inlined requests for batch processing.
InlinedResponse
A single response in a batch with optional metadata and error.
InlinedResponses
A list of inlined responses from batch processing.
InlineEnvironmentConfig
An inline EnvironmentConfig environment value.
InputConfig
Configures the input to a batch request.
InputEmbedContentConfig
Configures the input to an embed batch request.
InputFeedback
Feedback related to the input data used to answer the question, as opposed to the model-generated response to the question.
Interaction
The Interaction resource.
InteractionAudioResponseFormat
Configuration for audio output format.
InteractionCompletedEvent
An event indicating that an interaction has completed.
InteractionContent
The media content of an interaction step.
InteractionCreatedEvent
An event indicating that an interaction has been created.
InteractionError
An error from an interaction.
InteractionEvent
An event from the Interactions API streaming response.
InteractionGenerationConfig
Configuration parameters for model interactions.
InteractionImageConfig
The configuration for image interaction.
InteractionImageResponseFormat
Configuration for image output format.
InteractionInput
The input for an interaction.
InteractionResponseFormat
A single response format for an interaction.
InteractionResponseFormatConfig
The response_format configuration for an interaction.
InteractionResponseFormatList
A list of InteractionResponseFormats as the response-format configuration.
InteractionReviewSnippet
A review snippet from an interaction (uses snake_case JSON keys).
InteractionSingleResponseFormat
A single InteractionResponseFormat response-format configuration.
InteractionSpeechConfig
Configuration for speech interaction.
InteractionStatusUpdateEvent
An event indicating that an interaction's status has been updated.
InteractionStep
A step in an interaction.
InteractionTextResponseFormat
Configuration for text output format.
InteractionTool
A tool that can be used by the model.
InteractionToolChoice
Configuration for tool choice.
InteractionUsage
Statistics on the interaction request's token usage.
Interval
Represents a time interval.
LatLng
An object that represents a latitude/longitude pair.
ListAgentsResponse
The response from listing agents.
ListBatchesResponse
Response message for listing batch operations.
ListCachedContentsResponse
Response from listing cached contents.
ListCorporaResponse
Response from ListCorpora containing a paginated list of Corpora.
ListDocumentsResponse
Response from ListDocuments containing a paginated list of Documents.
ListFileSearchStoresResponse
Response from ListFileSearchStores containing a paginated list of FileSearchStores.
ListFilesResponse
Response from listing files.
ListGeneratedFilesResponse
Response for ListGeneratedFiles.
ListModelsResponse
Response from listing models.
ListOperationsResponse
Response from listing operations.
ListPermissionsResponse
Response message for listing permissions.
ListTunedModelsResponse
Response from listing tuned models.
ListWebhooksResponse
Response message for WebhookService.ListWebhooks.
LiveClient
Client for the Gemini Live API.
LiveConfig
Main configuration for Live API sessions.
LiveGenerationConfig
Generation configuration for Live API sessions.
LiveSession
A live streaming session with the Gemini Live API.
LiveVoices
Available prebuilt voices for Live API.
LogprobCandidate
A single candidate token with its log probability.
LogprobsResult
Token-level log probabilities.
LROPoller<T>
Poller for long-running operations (LRO).
Maps
A grounding chunk from Google Maps.
McpServer
A MCPServer is a server that can be called by the model to perform actions.
McpServerTool
A tool that allows the model to call an MCP (Model Context Protocol) server.
McpServerToolCallDelta
A streamed delta for an MCP server tool call.
McpServerToolCallStep
An MCP server tool call step.
McpServerToolResultDelta
A streamed delta for an MCP server tool result.
McpServerToolResultStep
Result of an MCP server tool call.
Media
A proto encapsulate various types of media.
MediaResolution
Media resolution for a media part.
MetadataFilter
User provided filter to limit retrieval based on Chunk or Document level metadata values.
ModalityTokenCount
Represents token counting info for a single modality.
ModalityTokens
Token count for a single response modality.
Model
Represents a model available in the GoogleAI API.
ModelOutputStep
A model-output step.
ModelStatus
Status of a model.
MultiSpeakerVoiceConfig
Configuration for multi-speaker voice output.
NoAuthCredentials
No authentication credentials.
NoAuthProvider
Provider that returns no authentication credentials.
Operation
Represents a long-running operation.
OperationError
Error information for a failed operation.
PaginatedResponse<T>
Generic paginated response.
Paginator<T>
Helper for paginated API responses.
ParallelAISearchConfig
Configuration for ParallelAISearch.
Part
A single unit of content (text, media, function call, etc.).
PartMetadataPart
Custom metadata.
Permission
Permission resource grants user, group or everyone access to a resource.
PlaceAnswerSources
Collection of sources that provide answers about the features of a given place in Google Maps.
PlaceCitation
A place citation annotation.
PrebuiltVoiceConfig
Configuration for prebuilt voices.
PredictLongRunningGeneratedVideoResponse
Veo response containing generated video samples.
PredictLongRunningMetadata
Metadata for PredictLongRunning long running operations.
PredictLongRunningOperation
Represents a long-running operation for video prediction.
PredictLongRunningRequest
Request message for PredictLongRunning operation.
PredictLongRunningResponse
Response message for PredictLongRunning operation.
PredictRequest
Request message for Predict operation.
PredictResponse
Response message for Predict operation.
ProactivityConfig
Configuration for proactive audio responses.
PromptFeedback
Feedback on the prompt in the request.
RagResource
A representation of a RagStore source.
RagRetrievalConfig
Retrieval config for a Rag query.
RagStoreConfig
Configuration for a RagStore-backed retrieval.
RankService
Config for the Rank Service used to rank and rerank retrieval results.
RealtimeInputConfig
Configuration for real-time input handling.
RegisterFilesRequest
Request to register files.
RegisterFilesResponse
Response from registering files.
RequestMetadata
Metadata about the HTTP request that caused an error.
ResponseFormatConfig
Configuration for the response output format.
ResponseMetadata
Metadata about the HTTP response that caused an error.
RetrievalConfig
Retrieval config.
RetrievalMetadata
Metadata related to retrieval in the grounding flow.
RetrievalTool
A tool that enables file retrieval capabilities.
RetrievedContext
Chunk from context retrieved by the file search tool.
RetryPolicy
Retry policy configuration.
ReviewSnippet
Encapsulates a snippet of a user review that answers a question about the features of a specific place in Google Maps.
RotateSigningSecretRequest
Request payload for WebhookService.RotateSigningSecret.
RotateSigningSecretResponse
Response payload for WebhookService.RotateSigningSecret.
SafetyRating
Safety rating for a piece of content.
SafetySetting
Safety setting to block content at different thresholds.
Schema
Schema for structured data.
SearchEntryPoint
Google search entry point.
SearchTypes
Search types configuration.
Segment
Segment of the content.
SemanticRetrieverChunk
Identifier for a Chunk retrieved via Semantic Retriever specified in the GenerateAnswerRequest using SemanticRetrieverConfig.
SemanticRetrieverConfig
Configuration for retrieving grounding content from a Corpus or Document created using the Semantic Retriever API.
SessionResumptionConfig
Configuration for session resumption.
SessionResumptionUpdate
Session resumption update message.
SigningSecret
A signing secret used to verify webhook payloads.
SingleContentInput
A single InteractionContent item as input.
SlidingWindow
Sliding window configuration for context compression.
Source
A source mounted into an environment's sandbox.
SpeakerVoiceConfig
Configuration for a single speaker's voice.
SpeechConfig
Configuration for speech synthesis.
Status
Error status information for RPC APIs.
StepDeltaData
A delta update for an interaction step.
StepDeltaEvent
An event carrying a partial update for a step in the interaction.
StepListInput
A list of InteractionStep items as input.
StepStartEvent
An event indicating that a new step has started in the interaction.
StepStopEvent
An event indicating that a step has finished in the interaction.
StreamableHttpTransport
A transport that can stream HTTP requests and responses.
StreamMetadata
Optional metadata accompanying any streamed interaction event.
TextAnnotationDelta
A text annotation delta update containing citation information.
TextContent
A text content block.
TextDelta
A text delta update.
TextInput
A simple text input.
TextPart
Text content.
TextResponseFormat
Configuration for text output format.
ThinkingConfig
Configuration for thinking features.
ThoughtPart
Reasoning step indicator.
ThoughtSignatureDelta
A thought signature delta update.
ThoughtSignaturePart
Cached thought key (base64).
ThoughtStep
A thought step.
ThoughtSummaryContent
A summary content item within a thought.
ThoughtSummaryContentImage
An ImageContent used as a thought summary item.
ThoughtSummaryContentText
A TextContent used as a thought summary item.
ThoughtSummaryDelta
A thought summary delta update.
Tool
Tool that the model may use to generate a response.
ToolCall
A server-side tool invocation predicted by the model.
ToolCallPart
Server-side tool call.
ToolConfig
The Tool configuration containing parameters for specifying Tool use in the request.
ToolResponse
The result of a tool invocation, passed back to the API in a subsequent turn alongside the corresponding ToolCall.
ToolResponsePart
Server-side tool response.
ToolResult
The result of a tool call.
ToolResultContentList
A list of subcontent items as a tool result.
ToolResultObject
An arbitrary JSON object as a tool result (fallback).
ToolResultText
A plain text string as a tool result.
TopCandidates
Top candidates for a token position.
Transcription
Transcription of audio content.
TransferOwnershipRequest
Request to transfer ownership of a resource.
TunedModel
A fine-tuned model.
TuningExample
A single training example.
TuningExamples
Training examples for tuning.
TuningTask
Record of a tuning task.
UnknownClientMessage
Unknown client message type.
UnknownInteractionEvent
An InteractionEvent whose event_type is not one of the documented variants.
UnknownInteractionResponseFormat
An InteractionResponseFormat whose type is not one of the documented variants (audio/text/image).
UnknownServerMessage
Unknown server message type.
UnknownStep
An InteractionStep whose type is not one of the documented variants.
UnknownStepDelta
A step.delta payload whose type is not one of the documented StepDeltaData variants.
UploadToFileSearchStoreRequest
Request for UploadToFileSearchStore.
UploadToFileSearchStoreResponse
Response from UploadToFileSearchStore.
UrlCitation
A URL citation annotation.
UrlContext
Tool that enables URL context fetching and analysis.
UrlContextCallDelta
A streamed delta for a URL context tool call.
UrlContextCallStep
A URL context tool call step.
UrlContextCallStepArguments
The arguments to pass to the URL context tool.
UrlContextResultDelta
A streamed delta for a URL context result.
UrlContextResultItem
A single result from a URL context fetch.
UrlContextResultStep
Result of a URL context call.
UrlContextTool
A tool that allows the model to fetch URL context.
UsageMetadata
Token usage metadata for the request/response.
UserInputStep
A user-input step.
VertexAISearchConfig
Configuration for Vertex AI Search.
Video
Representation of a video.
VideoContent
A video content block.
VideoDelta
A video delta update.
VideoMetadata
Metadata for a video file.
VideoMetadataPart
Video timing/sampling metadata.
VoiceConfig
Configuration for voice selection.
Web
Chunk from the web.
Webhook
A Webhook resource.
WebhookBatchExpiredEvent
A batch.expired webhook event.
WebhookBatchFailedEvent
A batch.failed webhook event.
WebhookBatchSucceededEvent
A batch.succeeded webhook event.
WebhookConfig
Webhook configuration for an interaction request.
WebhookEvent
A webhook delivery event.
WebhookInteractionCompletedEvent
An interaction.completed webhook event.
WebhookInteractionFailedEvent
An interaction.failed webhook event.
WebhookInteractionRequiresActionEvent
An interaction.requires_action webhook event.
WebhookUpdate
Update payload for a Webhook. All fields are optional.
WebhookVideoGeneratedEvent
A video.generated webhook event.
WebSearch
Web search configuration.
WhiteSpaceConfig
Configuration for a white space chunking algorithm.

Enums

AbortionStage
Stage at which request was aborted.
ActivityHandling
How the model handles user activity during generation.
AnswerStyle
Style in which answers should be returned.
ApiMode
API mode determining which Google AI service to use.
ApiVersion
API version for the GoogleAI and Vertex AI APIs. https://ai.google.dev/gemini-api/docs/api-versions
AudioResponseFormatDelivery
Delivery mode for an audio response.
AudioResponseFormatMimeType
MIME type of the audio output.
AuthPlacement
Authentication placement strategy.
BatchState
State of a batch operation.
BlockReason
Specifies the reason why the input was blocked.
CodeExecutionLanguage
Programming language used by CodeExecutionCallStepArguments.
ComputerUseEnvironment
The environment for computer use.
DeepResearchVisualization
Whether to include visualizations in the Deep Research response.
DocumentState
State of a Document.
DynamicRetrievalMode
The mode of the predictor to be used in dynamic retrieval.
EndSensitivity
Sensitivity for detecting the end of user speech.
EphemeralTokenPlacement
Ephemeral token placement strategy.
FileSource
Source of a file.
FileState
State of an uploaded file.
FinishReason
Why generation stopped.
FunctionCallingMode
Function calling mode.
FunctionResponseScheduling
Scheduling options for function responses.
GeneratedFileState
The state of a GeneratedFile.
GoogleSearchType
The type of search grounding enabled by GoogleSearchCallStep.
GranteeType
The type of grantee for a permission.
GroundingToolType
Grounding tool type associated with a GroundingToolCount.
HarmBlockThreshold
Threshold for blocking harmful content.
HarmCategory
Harm categories that can be blocked.
HarmProbability
The probability that content is harmful.
ImageResponseFormatAspectRatio
The aspect ratio for the image output.
ImageResponseFormatDelivery
Delivery mode for an image response.
ImageResponseFormatImageSize
The size of the image output.
ImageResponseFormatMimeType
MIME type of the image output.
InteractionAudioResponseFormatDelivery
Delivery mode for an audio response.
InteractionAudioResponseFormatMimeType
MIME type of the audio output.
InteractionImageResponseFormatAspectRatio
Aspect ratio for an image response.
InteractionImageResponseFormatDelivery
Delivery mode for an image response.
InteractionImageResponseFormatMimeType
MIME type of the image output.
InteractionImageResponseFormatSize
Image size for an image response.
InteractionMediaResolution
The resolution of media content in interactions.
InteractionResponseModality
The modality of a response.
InteractionStatus
The status of an interaction.
InteractionTextResponseFormatMimeType
MIME type of the text output.
InteractionThinkingLevel
Controls the level of thought tokens the model should generate.
InteractionThinkingSummaries
Controls whether to include thought summaries in the response.
InteractionToolChoiceType
The type of tool choice.
Language
Code execution language.
MediaResolutionLevel
Media resolution level.
ModelStage
Lifecycle stage of a model.
Outcome
Outcome of the code execution.
PermissionRole
The role granted by a permission.
ResponseModality
The modality of the response.
SchemaType
Schema type.
ServiceTier
The service tier for a request.
SigningSecretRevocationBehavior
Revocation behavior for previous signing secrets when rotating.
SourceType
The kind of a Source mounted into an environment.
StartSensitivity
Sensitivity for detecting the start of user speech.
TaskType
Type of task for which the embedding will be used.
TextResponseFormatMimeType
MIME type of the text output.
ThinkingLevel
Controls the depth of reasoning before generating responses.
ToolType
The type of tool.
TunedModelState
State of a tuned model.
TurnCoverage
How much input is included in a turn.
UrlContextResultStatus
Status of a URL retrieval.
WebhookState
State of a Webhook resource.

Extensions

CandidateExtensions on Candidate
Convenience extensions for Candidate.
ContentExtensions on Content
Convenience extensions for Content.
GenerateContentResponseExtensions on GenerateContentResponse
Convenience extensions for GenerateContentResponse.
InteractionExtensions on Interaction
Convenience extensions for Interaction.

Functions

answerStyleFromString(String? value) AnswerStyle
Converts string to AnswerStyle enum.
answerStyleToString(AnswerStyle style) String
Converts AnswerStyle enum to string.
audioResponseFormatDeliveryFromString(String? value) AudioResponseFormatDelivery
Converts a string to an AudioResponseFormatDelivery enum value.
audioResponseFormatDeliveryToString(AudioResponseFormatDelivery value) String
Converts an AudioResponseFormatDelivery enum value to a string.
audioResponseFormatMimeTypeFromString(String? value) AudioResponseFormatMimeType
Converts a string to an AudioResponseFormatMimeType enum value.
audioResponseFormatMimeTypeToString(AudioResponseFormatMimeType value) String
Converts an AudioResponseFormatMimeType enum value to a string.
batchStateFromString(String? value) BatchState
Converts a string to a BatchState.
batchStateToString(BatchState state) String
Converts a BatchState to a string.
blockReasonFromString(String? value) BlockReason
Converts string to BlockReason enum.
blockReasonToString(BlockReason reason) String
Converts BlockReason enum to string.
codeExecutionLanguageFromString(String? value) CodeExecutionLanguage?
Converts a JSON string to a CodeExecutionLanguage, or null if unrecognized (forward-compatible).
codeExecutionLanguageToString(CodeExecutionLanguage value) String
Converts a CodeExecutionLanguage to its JSON string.
computerUseEnvironmentFromString(String? value) ComputerUseEnvironment
Converts a string to a ComputerUseEnvironment enum value.
computerUseEnvironmentToString(ComputerUseEnvironment env) String
Converts a ComputerUseEnvironment enum value to a string.
deepResearchVisualizationFromString(String? value) DeepResearchVisualization?
Converts string to DeepResearchVisualization enum.
deepResearchVisualizationToString(DeepResearchVisualization value) String
Converts DeepResearchVisualization enum to string.
dynamicRetrievalModeFromString(String? value) DynamicRetrievalMode
Converts a string to a DynamicRetrievalMode enum value.
dynamicRetrievalModeToString(DynamicRetrievalMode mode) String
Converts a DynamicRetrievalMode enum value to a string.
fileSourceFromString(String? value) FileSource
Converts a string to a FileSource.
fileSourceToString(FileSource source) String
Converts a FileSource to a string.
fileStateFromString(String? value) FileState
Converts a string to a FileState.
fileStateToString(FileState state) String
Converts a FileState to a string.
finishReasonFromString(String? value) FinishReason
Converts string to FinishReason enum.
finishReasonToString(FinishReason reason) String
Converts FinishReason enum to string.
functionCallingModeFromString(String? value) FunctionCallingMode
Converts a string to a FunctionCallingMode.
functionCallingModeToString(FunctionCallingMode mode) String
Converts a FunctionCallingMode to a string.
generatedFileStateFromString(String? value) GeneratedFileState
Converts a string to a GeneratedFileState.
generatedFileStateToString(GeneratedFileState? state) String
Converts a GeneratedFileState to a string.
googleSearchTypeFromString(String? value) GoogleSearchType?
Converts a JSON string to a GoogleSearchType, or null if unrecognized (forward-compatible).
googleSearchTypeToString(GoogleSearchType value) String
Converts a GoogleSearchType to its JSON string.
granteeTypeFromString(String? value) GranteeType
Converts a string to GranteeType.
granteeTypeToString(GranteeType type) String
Converts GranteeType to a string.
groundingToolTypeFromString(String? value) GroundingToolType?
Converts a JSON string to a GroundingToolType, or null if unrecognized (forward-compatible).
groundingToolTypeToString(GroundingToolType value) String
Converts a GroundingToolType to its JSON string.
harmBlockThresholdFromString(String? value) HarmBlockThreshold
Converts string to HarmBlockThreshold enum.
harmBlockThresholdToString(HarmBlockThreshold threshold) String
Converts HarmBlockThreshold enum to string.
harmCategoryFromString(String? value) HarmCategory
Converts string to HarmCategory enum.
harmCategoryToString(HarmCategory category) String
Converts HarmCategory enum to string.
harmProbabilityFromString(String? value) HarmProbability
Converts string to HarmProbability enum.
harmProbabilityToString(HarmProbability probability) String
Converts HarmProbability enum to string.
imageResponseFormatAspectRatioFromString(String? value) ImageResponseFormatAspectRatio
Converts a string to an ImageResponseFormatAspectRatio enum value.
imageResponseFormatAspectRatioToString(ImageResponseFormatAspectRatio value) String
Converts an ImageResponseFormatAspectRatio enum value to a string.
imageResponseFormatDeliveryFromString(String? value) ImageResponseFormatDelivery
Converts a string to an ImageResponseFormatDelivery enum value.
imageResponseFormatDeliveryToString(ImageResponseFormatDelivery value) String
Converts an ImageResponseFormatDelivery enum value to a string.
imageResponseFormatImageSizeFromString(String? value) ImageResponseFormatImageSize
Converts a string to an ImageResponseFormatImageSize enum value.
imageResponseFormatImageSizeToString(ImageResponseFormatImageSize value) String
Converts an ImageResponseFormatImageSize enum value to a string.
imageResponseFormatMimeTypeFromString(String? value) ImageResponseFormatMimeType
Converts a string to an ImageResponseFormatMimeType enum value.
imageResponseFormatMimeTypeToString(ImageResponseFormatMimeType value) String
Converts an ImageResponseFormatMimeType enum value to a string.
interactionAudioResponseFormatDeliveryFromString(String? value) InteractionAudioResponseFormatDelivery?
Converts a JSON string to an InteractionAudioResponseFormatDelivery, or null if unrecognized (forward-compatible).
interactionAudioResponseFormatDeliveryToString(InteractionAudioResponseFormatDelivery value) String
Converts an InteractionAudioResponseFormatDelivery to its JSON string.
interactionAudioResponseFormatMimeTypeFromString(String? value) InteractionAudioResponseFormatMimeType?
Converts a JSON string to an InteractionAudioResponseFormatMimeType, or null if unrecognized (forward-compatible).
interactionAudioResponseFormatMimeTypeToString(InteractionAudioResponseFormatMimeType value) String
Converts an InteractionAudioResponseFormatMimeType to its JSON string.
interactionImageResponseFormatAspectRatioFromString(String? value) InteractionImageResponseFormatAspectRatio?
Converts a JSON string to an InteractionImageResponseFormatAspectRatio, or null if unrecognized (forward-compatible).
interactionImageResponseFormatAspectRatioToString(InteractionImageResponseFormatAspectRatio value) String
Converts an InteractionImageResponseFormatAspectRatio to its JSON string.
interactionImageResponseFormatDeliveryFromString(String? value) InteractionImageResponseFormatDelivery?
Converts a JSON string to an InteractionImageResponseFormatDelivery, or null if unrecognized (forward-compatible).
interactionImageResponseFormatDeliveryToString(InteractionImageResponseFormatDelivery value) String
Converts an InteractionImageResponseFormatDelivery to its JSON string.
interactionImageResponseFormatMimeTypeFromString(String? value) InteractionImageResponseFormatMimeType?
Converts a JSON string to an InteractionImageResponseFormatMimeType, or null if unrecognized (forward-compatible).
interactionImageResponseFormatMimeTypeToString(InteractionImageResponseFormatMimeType value) String
Converts an InteractionImageResponseFormatMimeType to its JSON string.
interactionImageResponseFormatSizeFromString(String? value) InteractionImageResponseFormatSize?
Converts a JSON string to an InteractionImageResponseFormatSize, or null if unrecognized (forward-compatible).
interactionImageResponseFormatSizeToString(InteractionImageResponseFormatSize value) String
Converts an InteractionImageResponseFormatSize to its JSON string.
interactionMediaResolutionFromString(String? value) InteractionMediaResolution
Converts a string to InteractionMediaResolution.
interactionMediaResolutionToString(InteractionMediaResolution resolution) String
Converts InteractionMediaResolution to a string.
interactionResponseModalityFromString(String? value) InteractionResponseModality
Converts a string to InteractionResponseModality.
interactionResponseModalityToString(InteractionResponseModality modality) String
Converts InteractionResponseModality to a string.
interactionStatusFromString(String? value) InteractionStatus
Converts a string to InteractionStatus.
interactionStatusToString(InteractionStatus status) String
Converts InteractionStatus to a string.
interactionTextResponseFormatMimeTypeFromString(String? value) InteractionTextResponseFormatMimeType?
Converts a JSON string to an InteractionTextResponseFormatMimeType, or null if unrecognized (forward-compatible).
interactionTextResponseFormatMimeTypeToString(InteractionTextResponseFormatMimeType value) String
Converts an InteractionTextResponseFormatMimeType to its JSON string.
interactionThinkingLevelFromString(String? value) InteractionThinkingLevel
Converts a string to InteractionThinkingLevel.
interactionThinkingLevelToString(InteractionThinkingLevel level) String
Converts InteractionThinkingLevel to a string.
interactionThinkingSummariesFromString(String? value) InteractionThinkingSummaries
Converts a string to InteractionThinkingSummaries.
interactionThinkingSummariesToString(InteractionThinkingSummaries summaries) String
Converts InteractionThinkingSummaries to a string.
interactionToolChoiceTypeFromString(String? value) InteractionToolChoiceType
Converts a string to InteractionToolChoiceType.
interactionToolChoiceTypeToString(InteractionToolChoiceType type) String
Converts InteractionToolChoiceType to a string.
mediaResolutionLevelFromString(String? value) MediaResolutionLevel
Converts a string to a MediaResolutionLevel enum value.
mediaResolutionLevelToString(MediaResolutionLevel level) String
Converts a MediaResolutionLevel enum value to a string.
modelStageFromString(String? value) ModelStage
Parses a ModelStage from its string representation.
modelStageToString(ModelStage value) String
Converts a ModelStage to its string representation.
permissionRoleFromString(String? value) PermissionRole
Converts a string to PermissionRole.
permissionRoleToString(PermissionRole role) String
Converts PermissionRole to a string.
responseModalityFromString(String? value) ResponseModality
Converts a string to a ResponseModality enum value.
responseModalityToString(ResponseModality modality) String
Converts a ResponseModality enum value to a string.
schemaTypeFromString(String? value) SchemaType
Converts string to SchemaType enum.
schemaTypeToString(SchemaType type) String
Converts SchemaType enum to string.
serviceTierFromString(String? value) ServiceTier
Parses a ServiceTier from its string representation.
serviceTierToString(ServiceTier value) String
Converts a ServiceTier to its string representation.
signingSecretRevocationBehaviorFromString(String? value) SigningSecretRevocationBehavior?
Converts a JSON string to a SigningSecretRevocationBehavior, or null if unrecognized (forward-compatible).
signingSecretRevocationBehaviorToString(SigningSecretRevocationBehavior value) String
Converts a SigningSecretRevocationBehavior to its JSON string.
sourceTypeFromString(String? value) SourceType?
Converts a JSON string to a SourceType, or null if unrecognized (forward-compatible).
sourceTypeToString(SourceType value) String
Converts a SourceType to its JSON string.
taskTypeFromString(String? value) TaskType
Converts string to TaskType enum.
taskTypeToString(TaskType type) String
Converts TaskType enum to string.
textResponseFormatMimeTypeFromString(String? value) TextResponseFormatMimeType
Converts a string to a TextResponseFormatMimeType enum value.
textResponseFormatMimeTypeToString(TextResponseFormatMimeType value) String
Converts a TextResponseFormatMimeType enum value to a string.
thinkingLevelFromString(String? value) ThinkingLevel
Converts string to ThinkingLevel enum.
thinkingLevelToString(ThinkingLevel level) String
Converts ThinkingLevel enum to string.
toolTypeFromString(String? value) ToolType
Converts a string to a ToolType enum value.
toolTypeToString(ToolType type) String
Converts a ToolType enum value to a string.
tunedModelStateFromString(String? value) TunedModelState
Converts a string to a TunedModelState.
tunedModelStateToString(TunedModelState state) String
Converts a TunedModelState to a string.
urlContextResultStatusFromString(String? value) UrlContextResultStatus?
Converts a JSON string to a UrlContextResultStatus, or null if unrecognized (forward-compatible).
urlContextResultStatusToString(UrlContextResultStatus value) String
Converts a UrlContextResultStatus to its JSON string.
webhookStateFromString(String? value) WebhookState?
Converts a JSON string to a WebhookState, or null if unrecognized (forward-compatible).
webhookStateToString(WebhookState value) String
Converts a WebhookState to its JSON string.

Exceptions / Errors

AbortedException
Exception thrown when a request is aborted by user.
ApiException
Exception for HTTP/API errors.
AuthenticationException
Exception for authentication errors (HTTP 401).
GoogleAIException
Base sealed class for all GoogleAI exceptions.
LiveConnectionException
Exception thrown when WebSocket connection fails.
LiveSessionClosedException
Exception thrown when the Live session is closed.
LiveSessionException
Exception thrown for general Live session errors.
LiveSessionResumptionException
Exception thrown when session resumption fails.
LiveSessionSetupException
Exception thrown when session setup fails.
RateLimitException
Exception for rate limit (429) errors.
StreamException
Exception for errors detected in streaming data.
TimeoutException
Exception for request timeouts.
ValidationException
Exception for client-side validation errors.