#[non_exhaustive]pub enum SessionEvent {
Show 20 variants
Connected,
TextDelta(String),
TextComplete(String),
AudioData(Bytes),
InputTranscription(String),
OutputTranscription(String),
Thought(String),
ToolCall(Vec<FunctionCall>),
ToolCallCancelled(Vec<String>),
TurnComplete,
GenerationComplete,
Interrupted,
PhaseChanged(SessionPhase),
GoAway(Option<Duration>),
Disconnected(Option<String>),
Error(SessionError),
SessionResumeUpdate(ResumeInfo),
VoiceActivityStart,
VoiceActivityEnd,
Usage(UsageMetadata),
}Expand description
Events emitted by the session, consumed by application code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connected
Session connected and setup complete.
TextDelta(String)
Incremental text from model response.
TextComplete(String)
Complete text of a finished model turn.
AudioData(Bytes)
Audio data from model response (PCM16 samples, base64-decoded).
Uses [bytes::Bytes] for zero-copy fan-out: cloning a Bytes handle
bumps an Arc refcount instead of copying the underlying data.
InputTranscription(String)
Input transcription from server.
OutputTranscription(String)
Output transcription from server.
Thought(String)
Thought/reasoning summary from the model (when includeThoughts is enabled).
ToolCall(Vec<FunctionCall>)
Model requested tool calls.
ToolCallCancelled(Vec<String>)
Server cancelled pending tool calls.
TurnComplete
Model turn is complete (it’s the user’s turn now).
GenerationComplete
Model finished generating its full response.
Fires even if the generation was interrupted — tells you the model’s
internal generation pipeline has stopped. Distinct from TurnComplete
which is the turn-taking signal.
Interrupted
Model was interrupted by barge-in.
PhaseChanged(SessionPhase)
Session phase changed.
GoAway(Option<Duration>)
Server sent GoAway: it will close the connection after time_left
(when it said how long). The transport reconnects on its own; this
is the moment to drain buffered audio and expect a resumption handle.
Disconnected(Option<String>)
Session disconnected (with optional reason).
Error(SessionError)
Non-fatal error. The session loop keeps running (reconnecting where
the transport allows); match on the SessionError variants to tell
a refused setup from a dropped socket.
SessionResumeUpdate(ResumeInfo)
Session resumption update with handle, resumability, and consumed index.
VoiceActivityStart
Server-side voice activity detected (user started speaking).
VoiceActivityEnd
Server-side voice activity ended (user stopped speaking).
Usage(UsageMetadata)
Token usage metadata from server (for context window tracking).
Contains full token breakdown: prompt, response, cached, tool-use, thinking tokens, plus per-modality details.
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for SessionEvent
impl RefUnwindSafe for SessionEvent
impl Send for SessionEvent
impl Sync for SessionEvent
impl Unpin for SessionEvent
impl UnwindSafe for SessionEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].