Expand description
Core types that map one-to-one to the Gemini Multimodal Live API wire format.
Structs§
- Audio
Transcription Config - Audio transcription settings, for the user’s audio
(
inputAudioTranscription) or the model’s (outputAudioTranscription). - Automatic
Activity Detection - Automatic activity detection (VAD) settings.
- Avatar
Config - Live Avatar video output (Gemini 3.8 Live): a prebuilt avatar by name, or a custom one generated from a reference image.
- Blob
- A blob of inline data (audio, image, etc.) sent to or received from Gemini.
- Citation
Metadata - Citation metadata for a response.
- Citation
Source - A single citation source.
- Code
Execution Result - Result of code execution.
- Content
- A content message containing a role and a sequence of parts.
- Context
Update - A mid-session replacement of the model preamble: the system instruction,
the declared tools, or both. Sent as a
contextUpdatemessage. - Context
Window Compression Config - Context window compression configuration for long sessions.
- Customized
Avatar - The reference image of a custom avatar.
- Executable
Code - Executable code returned by the model.
- File
Data - Reference to an uploaded file.
- Function
Call - A function call request from the model.
- Function
Calling Config - Configuration for function calling behavior.
- Function
Declaration - Schema for a single function that the model can call.
- Function
Response - A function call response sent back to the model.
- Generation
Config - Generation config sent in the setup message.
- Google
Search - Google Search tool configuration (empty — presence enables the feature).
- Google
Search Retrieval - Google Search retrieval tool configuration.
- Grounding
Metadata - Grounding metadata for server content with search results.
- History
Config - How conversation history seeded with
clientContentis treated. - Live
Model Profile - What a Live model accepts in its setup message, as far as this crate knows.
- Modality
Token Count - Token count breakdown by modality (text, audio, image, video).
- ModelId
- A Gemini model identifier, exactly as the API accepts it.
- Prebuilt
Voice Config - Prebuilt voice selection.
- Proactivity
Config - Proactivity configuration — controls whether the model can initiate responses.
- Realtime
Input Config - Server-side VAD configuration for the setup message.
- Replicated
Voice Config - A voice the model replicates from a recorded sample, configured per session. Nothing is uploaded or trained in advance.
- Safety
Rating - Per-category safety assessment of generated content.
- Safety
Setting - Per-category safety configuration for content generation.
- Session
Config - Complete session configuration — the builder entrypoint.
- Session
Resumption Config - Session resumption configuration.
- Sliding
Window - Sliding window configuration for context compression.
- Speech
Config - Speech configuration for audio output.
- Thinking
Config - Configuration for model thinking/reasoning (Gemini 2.5+).
- Tool
- A tool declaration sent in the setup message. Each Tool object can contain one of: function declarations, urlContext, googleSearch, codeExecution, or googleSearchRetrieval.
- Tool
Code Execution - Code execution tool configuration (empty — presence enables the feature).
- Tool
Config - Controls how and when the model uses tools.
- UrlContext
- URL context tool configuration (empty — presence enables the feature).
- UrlContext
Metadata - URL context metadata for content sourced from URLs.
- Usage
Metadata - Usage metadata returned by the server on messages.
- Vertex
Config - Configuration for connecting through Vertex AI.
- Voice
Config - Voice configuration within speech config: a prebuilt voice, or a voice replicated from a sample.
Enums§
- Access
Token - An OAuth2 access token source.
- Activity
Handling - Controls how incoming audio interacts with model output.
- ApiEndpoint
- API endpoint selector — Google AI (direct), Google AI with OAuth token, or Vertex AI.
- Audio
Format - Audio encoding formats supported by the Gemini Live API.
- Endpoint
EnvError - Error resolving an
ApiEndpointfrom the environment. - Finish
Reason - Why the model stopped generating.
- Function
Calling Behavior - Whether tool calls block model output or run concurrently.
- Function
Calling Mode - How the model should decide when to execute tool calls.
- Function
Response Scheduling - Scheduling mode for non-blocking function responses.
- Harm
Block Threshold - Blocking threshold for safety settings.
- Harm
Category - Categories of potential harm in model output.
- Harm
Probability - Probability that content is harmful.
- Media
Resolution - Media resolution for image/video inputs: the per-frame token budget.
- Modality
- Output modalities the model can produce.
- Part
- A single part of a
Contentmessage. Parts are polymorphic — discriminated by field presence, not a type tag. - Role
- Role in a conversation.
- Sensitivity
- Voice activity detection sensitivity level.
- Thinking
Level - How much a model thinks before answering, for models that take a level rather than a token budget.
- Turn
Coverage - Controls which input counts toward a user’s conversation turn.
- Voice
- Available voice presets for Gemini Live audio output.
Constants§
- API_
KEY_ ENV_ VARS - The environment variables
api_key_from_envreads, first match wins. - LIVE_
INPUT_ SAMPLE_ RATE - The sample rate the Live API takes on the way in.
Traits§
- Tool
Provider - Declares tools for a Gemini session setup message. Implement this trait to provide tools from any source (runtime ToolDispatcher, etc.).
Functions§
- api_
key_ from_ env - The Google AI API key from the environment: the first non-empty of
GEMINI_API_KEY,GOOGLE_GENAI_API_KEY,GOOGLE_API_KEY. - cloud_
location_ from_ env - The Vertex AI location from
GOOGLE_CLOUD_LOCATION,us-central1when unset or empty. - cloud_
project_ from_ env - The Vertex AI project from
GOOGLE_CLOUD_PROJECT, if set and non-empty. - non_
empty_ env - Read an environment variable, treating empty/whitespace as unset and trimming the rest.
- provider_
key_ variable - The name of the first of
API_KEY_ENV_VARSthat holds a non-empty value, for messages that say which variable supplied the key. It returns the variable’s name, never its value, so printing it is safe (and the name says so, for static analysers that treat anything calledapi_keyas a secret). - vertex_
flag_ enabled - Whether a
GOOGLE_GENAI_USE_VERTEXAIvalue selects Vertex AI:true(any case) or1, ignoring surrounding whitespace. - vertex_
requested - Whether
GOOGLE_GENAI_USE_VERTEXAIselects Vertex AI (trueor1). Unset means the Gemini API.
Type Aliases§
- Input
Audio Transcription - Input audio transcription configuration.
- Output
Audio Transcription - Output audio transcription configuration.