Expand description
L0 wire-protocol types for raw WebSocket access.
Structs§
- Audio
Jitter Buffer - Adaptive jitter buffer for audio playback.
- Automatic
Activity Detection - Automatic activity detection (VAD) settings.
- Barge
InConfig - Configuration for barge-in behavior.
- Barge
InDetector - Barge-in detector — checks whether user speech should interrupt model output.
- Batch
Job - A batch prediction job resource.
- Batch
JobDestination - Destination configuration for a batch job.
- Batch
JobSource - Source configuration for a batch job.
- Blob
- A blob of inline data (audio, image, etc.) sent to or received from Gemini.
- Cached
Content - Cached content resource.
- Cached
Content Usage Metadata - Usage metadata for cached content.
- Chat
Session - A stateful chat session that tracks conversation history.
- Citation
Metadata - Citation metadata for a response.
- Citation
Source - A single citation source.
- Code
Execution Result - Result of code execution.
- Connect
Builder - Connects a
SessionConfigwith options: transport tuning, a custom transport or codec, a wire recorder.connectis the same thing with none of them. - Content
- A content message containing a role and a sequence of parts.
- Content
Embedding - Embedding vector.
- Context
Window Compression Config - Context window compression configuration for long sessions.
- Count
Tokens Response - Response from countTokens.
- Create
Batch JobConfig - Configuration for creating a batch job.
- Create
Cached Content Config - Configuration for creating cached content.
- Create
Tuning JobConfig - Configuration for creating a tuning job.
- Embed
Content Config - Configuration for embed requests.
- Embed
Content Response - Response from embedContent.
- 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.
- Generate
Content Config - Configuration for a generateContent request.
- Generate
Content Response - Top-level response from generateContent.
- Generation
Config - Generation config sent in the setup message.
- GoogleAI
Auth - Google AI API key authentication.
- GoogleAI
Token Auth - Google AI OAuth2 access token authentication.
- 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.
- Http
Client - HTTP client wrapping reqwest with retry and telemetry.
- Http
Config - Configuration for the HTTP client.
- Input
Audio Transcription - Input audio transcription configuration.
- Jitter
Config - Configuration for the jitter buffer.
- Json
Codec - Default JSON codec — current behavior extracted from connection.rs.
- List
Batch Jobs Response - Response from listBatchJobs.
- List
Cached Contents Response - Response from listCachedContents.
- List
Models Response - Response from list models.
- List
Tuning Jobs Response - Response from listTuningJobs.
- Mock
Transport - Mock transport for unit testing.
- Modality
Token Count - Token count breakdown by modality (text, audio, image, video).
- ModelId
- A Gemini model identifier, exactly as the API accepts it.
- Output
Audio Transcription - Output audio transcription configuration.
- 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.
- Resume
Info - Session resumption information from the server.
- 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
Handle - The public API surface for a Gemini Live session.
- Session
Resumption Config - Session resumption configuration.
- Sliding
Window - Sliding window configuration for context compression.
- Speech
Config - Speech configuration for audio output.
- Spsc
Consumer - The reading half of an
SpscRing. - Spsc
Producer - The writing half of an
SpscRing. - Spsc
Ring - Wait-free single-producer single-consumer ring buffer for audio samples.
- Supervised
Tuning Spec - Supervised tuning specification.
- 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.
- Transport
Config - Configuration for the transport layer.
- Tungstenite
Transport - WebSocket transport using
tokio-tungstenite. - Tuning
Hyper Parameters - Tuning hyperparameters.
- Tuning
Job - A tuning job resource.
- Turn
Detection Config - Configuration for client-side turn detection.
- Turn
Detector - Client-side turn detector.
- Update
Cached Content Request - Updates to apply to a cached content resource.
- 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.
- VadConfig
- VAD configuration parameters.
- VertexAI
Auth - Vertex AI Bearer token authentication.
- Vertex
Config - Configuration for connecting through Vertex AI.
- Voice
Activity Detector - Voice Activity Detector with adaptive noise floor.
- Voice
Config - Voice configuration within speech config.
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.
- Auth
Error - Authentication-specific errors.
- Barge
InAction - Result of a barge-in check.
- Batch
JobState - State of a batch job.
- Batches
Error - Errors from the Batches API.
- Buffer
State - Current state of the jitter buffer.
- Caches
Error - Errors from the Caches API.
- Codec
Error - Error during encoding or decoding.
- Embed
Error - Errors from the Embed 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.
- Generate
Error - Errors specific to the Generate API.
- Harm
Block Threshold - Blocking threshold for safety settings.
- Harm
Category - Categories of potential harm in model output.
- Harm
Probability - Probability that content is harmful.
- Http
Error - Errors from HTTP client operations.
- Media
Resolution - Media resolution for image/video inputs.
- Modality
- Output modalities the model can produce.
- Models
Error - Errors from the Models API.
- 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.
- Server
Message - Unified server message enum — parsed from incoming WebSocket text frames.
- Service
Endpoint - Identifies which Gemini API service to connect to.
- Session
Command - Commands sent from application code to the session transport.
- Session
Error - Errors that can occur during a session.
- Session
Event - Events emitted by the session, consumed by application code.
- Session
Phase - The lifecycle phase of a Gemini Live session.
- Setup
Error - Errors during the setup handshake phase.
- Tokens
Error - Errors from the Tokens API.
- Tungstenite
Error - Errors from the
TungsteniteTransport. - Tuning
JobState - State of a tuning job.
- Tunings
Error - Errors from the Tunings API.
- Turn
Coverage - Controls which input counts toward a user’s conversation turn.
- Turn
Detection Event - Events from the turn detector.
- VadEvent
- Events emitted by the VAD.
- Voice
- Available voice presets for Gemini Live audio output.
- WebSocket
Error - WebSocket-level errors with structured detail.
Constants§
- LIVE_
INPUT_ SAMPLE_ RATE - The sample rate the Live API takes on the way in.
Traits§
- Auth
Provider - Provides authentication credentials and URL construction for Gemini API connections.
- Codec
- Encodes client commands into wire bytes and decodes server bytes into messages.
- Session
Reader - Read-side of a session — subscribe to events and observe phase.
- Session
Writer - Write-side of a session — send commands without owning the full handle.
- Tool
Provider - Declares tools for a Gemini session setup message. Implement this trait to provide tools from any source (runtime ToolDispatcher, etc.).
- Transport
- A bidirectional message transport.
Functions§
- bytes_
to_ i16 - Convert raw bytes to i16 PCM samples (zero-copy via bytemuck).
- connect
- Connect to the Gemini Multimodal Live API with the default transport and return a session handle.
- i16_
to_ bytes - Convert a slice of i16 PCM samples to raw bytes (zero-copy via bytemuck).
- into_
shared - Wrap raw bytes as a shared
Byteshandle for zero-copy fan-out. - recv_
event - Receive the next event from a broadcast receiver, handling lag gracefully.