Module wire

Module wire 

Source
Expand description

L0 wire-protocol types for raw WebSocket access.

Modules§

client
Client → Server message types for the Gemini Live wire protocol.
server
Server → Client message types for the Gemini Live wire protocol.

Structs§

ActivityEnd
Marker for speech activity end.
ActivitySignalMessage
Activity signal for client-side VAD events.
ActivitySignalPayload
Payload for activity signals.
ActivityStart
Marker for speech activity start.
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.
Blob
A blob of inline data (audio, image, etc.) sent to or received from Gemini.
Candidate
A single response candidate.
CitationMetadata
Citation metadata for a response.
CitationSource
A single citation source.
Client
Unified Gemini API client.
ClientContentMessage
Client content message for sending text or conversation history.
ClientContentPayload
Payload for client content.
CodeExecutionResult
Result of code execution.
ConnectBuilder
Builder for advanced connection configuration.
Content
A content message containing a role and a sequence of parts.
ContextWindowCompressionConfig
Context window compression configuration for long sessions.
ExecutableCode
Executable code returned by the model.
FileData
Reference to an uploaded file.
FileWireRecorder
Durable WireRecorder writing one JSON object per line (JSONL).
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.
GoAwayMessage
Server GoAway signal — requesting graceful disconnect.
GoAwayPayload
Payload for GoAway.
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.
MediaChunk
A single chunk of media data (audio). Deprecated — use Blob in audio field.
MemoryWireRecorder
In-memory WireRecorder for tests and replay harnesses.
MockTransport
Mock transport for unit testing.
ModalityTokenCount
Token count breakdown by modality (text, audio, image, video).
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.
RealtimeInputMessage
Realtime audio input sent as a stream of chunks.
RealtimeInputPayload
Payload for realtime audio input.
RecordingCodec
A Codec decorator that records every byte crossing the wire.
ReplayControl
Control handle for a ReplayTransport that has been moved into a session loop.
ReplayTransport
A Transport that replays recorded inbound frames and collects outbound frames. See the module docs for gating and drain semantics.
ResumeInfo
Session resumption information from the server.
SafetyRating
Per-category safety assessment of generated content.
SafetySetting
Per-category safety configuration for content generation.
ServerContentMessage
Server content message containing model output.
ServerContentPayload
Payload for server content.
ServerMessageWrapper
Server message wrapper — includes optional usage metadata alongside the message.
SessionConfig
Complete session configuration — the builder entrypoint.
SessionHandle
The public API surface for a Gemini Live session.
SessionResumptionConfig
Session resumption configuration.
SessionResumptionResult
Session resumption result from server.
SessionResumptionUpdateMessage
Session resumption update from server (sent during active session).
SessionResumptionUpdatePayload
Payload for session resumption update.
SetupCompleteMessage
Server setup complete acknowledgment.
SetupCompletePayload
Payload for setup complete.
SetupMessage
Top-level setup message sent immediately after WebSocket connect.
SetupPayload
Payload of the setup message.
SlidingWindow
Sliding window configuration for context compression.
SpeechConfig
Speech configuration for audio output.
SpscRing
Lock-free single-producer single-consumer ring buffer.
TelemetryConfig
Telemetry configuration.
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.
ToolCallCancellationMessage
Server tool call cancellation message.
ToolCallCancellationPayload
Payload for tool call cancellation.
ToolCallMessage
Server tool call request message.
ToolCallPayload
Payload for tool call.
ToolCodeExecution
Code execution tool configuration (empty — presence enables the feature).
ToolConfig
Controls how and when the model uses tools.
ToolResponseMessage
Tool response message sent after executing function calls.
ToolResponsePayload
Payload for tool response.
TranscriptionPayload
Transcription text from server.
TransportConfig
Configuration for the transport layer.
TungsteniteTransport
WebSocket transport using tokio-tungstenite.
TurnDetectionConfig
Configuration for client-side turn detection.
TurnDetector
Client-side turn detector.
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.
VoiceActivityMessage
Server-side voice activity detection event.
VoiceActivityPayload
Payload for voice activity detection.
VoiceConfig
Voice configuration within speech config.
WireEntry
One recorded wire frame: sequence, direction, timestamp, raw payload.
WireRecorderHandle
Cloneable, Debug-friendly handle to a shared WireRecorder.

Enums§

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.
CodecError
Error during encoding or decoding.
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.
GeminiModel
Gemini models that support the Multimodal Live API.
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.
Part
A single part of a Content message. Parts are polymorphic — discriminated by field presence, not a type tag.
Platform
Which platform variant to use for the Gemini API.
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.
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.
VoiceActivityType
Type of voice activity event from the server.
WebSocketError
WebSocket-level errors with structured detail.
WireDirection
Direction of a recorded wire frame, relative to the client.
WireLogError
Error reading a JSONL wire log.

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.
WireRecorder
Synchronous sink for recorded wire frames.

Functions§

bytes_to_i16
Convert raw bytes to i16 PCM samples (zero-copy via bytemuck).
connect
Connect to the Gemini Multimodal Live API and return a session handle.
connect_with
Connect with a custom transport and codec.
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.
quick_connect
Connect to Gemini Live with minimal configuration.
quick_connect_vertex
Connect via Vertex AI with minimal configuration.
read_wire_log
Read a JSONL wire log written by FileWireRecorder back into entries.
recv_event
Receive the next event from a broadcast receiver, handling lag gracefully.

Type Aliases§

ToolDeclaration
Backward-compatible alias for Tool.