Module wire

Module wire 

Source
Expand description

L0 wire-protocol types for raw WebSocket access.

Structs§

AudioJitterBuffer
Adaptive jitter buffer for audio playback.
AutomaticActivityDetection
Automatic activity detection (VAD) settings.
BargeInConfig
Configuration for barge-in behavior.
BargeInDetector
Barge-in detector — checks whether user speech should interrupt model output.
BatchJob
A batch prediction job resource.
BatchJobDestination
Destination configuration for a batch job.
BatchJobSource
Source configuration for a batch job.
Blob
A blob of inline data (audio, image, etc.) sent to or received from Gemini.
CachedContent
Cached content resource.
CachedContentUsageMetadata
Usage metadata for cached content.
ChatSession
A stateful chat session that tracks conversation history.
CitationMetadata
Citation metadata for a response.
CitationSource
A single citation source.
CodeExecutionResult
Result of code execution.
ConnectBuilder
Connects a SessionConfig with options: transport tuning, a custom transport or codec, a wire recorder. connect is the same thing with none of them.
Content
A content message containing a role and a sequence of parts.
ContentEmbedding
Embedding vector.
ContextWindowCompressionConfig
Context window compression configuration for long sessions.
CountTokensResponse
Response from countTokens.
CreateBatchJobConfig
Configuration for creating a batch job.
CreateCachedContentConfig
Configuration for creating cached content.
CreateTuningJobConfig
Configuration for creating a tuning job.
EmbedContentConfig
Configuration for embed requests.
EmbedContentResponse
Response from embedContent.
ExecutableCode
Executable code returned by the model.
FileData
Reference to an uploaded file.
FunctionCall
A function call request from the model.
FunctionCallingConfig
Configuration for function calling behavior.
FunctionDeclaration
Schema for a single function that the model can call.
FunctionResponse
A function call response sent back to the model.
GenerateContentConfig
Configuration for a generateContent request.
GenerateContentResponse
Top-level response from generateContent.
GenerationConfig
Generation config sent in the setup message.
GoogleAIAuth
Google AI API key authentication.
GoogleAITokenAuth
Google AI OAuth2 access token authentication.
GoogleSearch
Google Search tool configuration (empty — presence enables the feature).
GoogleSearchRetrieval
Google Search retrieval tool configuration.
GroundingMetadata
Grounding metadata for server content with search results.
HttpClient
HTTP client wrapping reqwest with retry and telemetry.
HttpConfig
Configuration for the HTTP client.
InputAudioTranscription
Input audio transcription configuration.
JitterConfig
Configuration for the jitter buffer.
JsonCodec
Default JSON codec — current behavior extracted from connection.rs.
ListBatchJobsResponse
Response from listBatchJobs.
ListCachedContentsResponse
Response from listCachedContents.
ListModelsResponse
Response from list models.
ListTuningJobsResponse
Response from listTuningJobs.
MockTransport
Mock transport for unit testing.
ModalityTokenCount
Token count breakdown by modality (text, audio, image, video).
ModelId
A Gemini model identifier, exactly as the API accepts it.
OutputAudioTranscription
Output audio transcription configuration.
PrebuiltVoiceConfig
Prebuilt voice selection.
ProactivityConfig
Proactivity configuration — controls whether the model can initiate responses.
RealtimeInputConfig
Server-side VAD configuration for the setup message.
ResumeInfo
Session resumption information from the server.
SafetyRating
Per-category safety assessment of generated content.
SafetySetting
Per-category safety configuration for content generation.
SessionConfig
Complete session configuration — the builder entrypoint.
SessionHandle
The public API surface for a Gemini Live session.
SessionResumptionConfig
Session resumption configuration.
SlidingWindow
Sliding window configuration for context compression.
SpeechConfig
Speech configuration for audio output.
SpscConsumer
The reading half of an SpscRing.
SpscProducer
The writing half of an SpscRing.
SpscRing
Wait-free single-producer single-consumer ring buffer for audio samples.
SupervisedTuningSpec
Supervised tuning specification.
ThinkingConfig
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.
ToolCodeExecution
Code execution tool configuration (empty — presence enables the feature).
ToolConfig
Controls how and when the model uses tools.
TransportConfig
Configuration for the transport layer.
TungsteniteTransport
WebSocket transport using tokio-tungstenite.
TuningHyperParameters
Tuning hyperparameters.
TuningJob
A tuning job resource.
TurnDetectionConfig
Configuration for client-side turn detection.
TurnDetector
Client-side turn detector.
UpdateCachedContentRequest
Updates to apply to a cached content resource.
UrlContext
URL context tool configuration (empty — presence enables the feature).
UrlContextMetadata
URL context metadata for content sourced from URLs.
UsageMetadata
Usage metadata returned by the server on messages.
VadConfig
VAD configuration parameters.
VertexAIAuth
Vertex AI Bearer token authentication.
VertexConfig
Configuration for connecting through Vertex AI.
VoiceActivityDetector
Voice Activity Detector with adaptive noise floor.
VoiceConfig
Voice configuration within speech config.

Enums§

AccessToken
An OAuth2 access token source.
ActivityHandling
Controls how incoming audio interacts with model output.
ApiEndpoint
API endpoint selector — Google AI (direct), Google AI with OAuth token, or Vertex AI.
AudioFormat
Audio encoding formats supported by the Gemini Live API.
AuthError
Authentication-specific errors.
BargeInAction
Result of a barge-in check.
BatchJobState
State of a batch job.
BatchesError
Errors from the Batches API.
BufferState
Current state of the jitter buffer.
CachesError
Errors from the Caches API.
CodecError
Error during encoding or decoding.
EmbedError
Errors from the Embed API.
EndpointEnvError
Error resolving an ApiEndpoint from the environment.
FinishReason
Why the model stopped generating.
FunctionCallingBehavior
Whether tool calls block model output or run concurrently.
FunctionCallingMode
How the model should decide when to execute tool calls.
FunctionResponseScheduling
Scheduling mode for non-blocking function responses.
GenerateError
Errors specific to the Generate API.
HarmBlockThreshold
Blocking threshold for safety settings.
HarmCategory
Categories of potential harm in model output.
HarmProbability
Probability that content is harmful.
HttpError
Errors from HTTP client operations.
MediaResolution
Media resolution for image/video inputs.
Modality
Output modalities the model can produce.
ModelsError
Errors from the Models API.
Part
A single part of a Content message. Parts are polymorphic — discriminated by field presence, not a type tag.
Role
Role in a conversation.
Sensitivity
Voice activity detection sensitivity level.
ServerMessage
Unified server message enum — parsed from incoming WebSocket text frames.
ServiceEndpoint
Identifies which Gemini API service to connect to.
SessionCommand
Commands sent from application code to the session transport.
SessionError
Errors that can occur during a session.
SessionEvent
Events emitted by the session, consumed by application code.
SessionPhase
The lifecycle phase of a Gemini Live session.
SetupError
Errors during the setup handshake phase.
TokensError
Errors from the Tokens API.
TungsteniteError
Errors from the TungsteniteTransport.
TuningJobState
State of a tuning job.
TuningsError
Errors from the Tunings API.
TurnCoverage
Controls which input counts toward a user’s conversation turn.
TurnDetectionEvent
Events from the turn detector.
VadEvent
Events emitted by the VAD.
Voice
Available voice presets for Gemini Live audio output.
WebSocketError
WebSocket-level errors with structured detail.

Constants§

LIVE_INPUT_SAMPLE_RATE
The sample rate the Live API takes on the way in.

Traits§

AuthProvider
Provides authentication credentials and URL construction for Gemini API connections.
Codec
Encodes client commands into wire bytes and decodes server bytes into messages.
SessionReader
Read-side of a session — subscribe to events and observe phase.
SessionWriter
Write-side of a session — send commands without owning the full handle.
ToolProvider
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 Bytes handle for zero-copy fan-out.
recv_event
Receive the next event from a broadcast receiver, handling lag gracefully.