Skip to main content

ServerEvent

Enum ServerEvent 

Source
#[non_exhaustive]
pub enum ServerEvent {
Show 31 variants Error { error: ServerErrorBody, }, SessionCreated { session: RealtimeSessionInfo, }, SessionUpdated { session: SessionConfig, }, ConversationCreated { conversation: RealtimeConversation, }, ConversationItemCreated { item: RealtimeConversationItem, }, ConversationItemDeleted { item_id: String, }, ConversationItemRetrieved { item: RealtimeConversationItem, }, InputAudioTranscriptionCompleted { item_id: String, content_index: Option<u64>, transcript: String, }, InputAudioTranscriptionFailed { item_id: String, content_index: Option<u64>, error: ServerErrorBody, }, InputAudioBufferCommitted { item_id: String, }, InputAudioBufferCleared, InputAudioBufferSpeechStarted { audio_start_ms: Option<u64>, item_id: Option<String>, }, InputAudioBufferSpeechStopped { audio_end_ms: Option<u64>, item_id: Option<String>, }, ResponseOutputItemAdded { response_id: String, output_index: u64, item: RealtimeConversationItem, }, ResponseOutputItemDone { response_id: String, output_index: u64, item: RealtimeConversationItem, }, ResponseContentPartAdded { response_id: String, item_id: String, output_index: u64, content_index: u64, part: ItemContent, }, ResponseContentPartDone { response_id: String, item_id: String, output_index: u64, content_index: u64, part: ItemContent, }, ResponseCreated { response: RealtimeResponse, }, ResponseDone { response: RealtimeResponse, }, ResponseCancelled { response: RealtimeResponse, }, ResponseTextDelta { response_id: String, item_id: String, output_index: Option<u64>, content_index: Option<u64>, delta: String, }, ResponseTextDone { response_id: String, item_id: String, output_index: Option<u64>, content_index: Option<u64>, text: Option<String>, }, ResponseAudioDelta { response_id: String, item_id: String, output_index: Option<u64>, content_index: Option<u64>, delta: String, }, ResponseAudioDone { response_id: String, item_id: String, output_index: Option<u64>, content_index: Option<u64>, }, ResponseAudioTranscriptDelta { response_id: String, item_id: String, output_index: Option<u64>, content_index: Option<u64>, delta: String, }, ResponseAudioTranscriptDone { response_id: String, item_id: String, output_index: Option<u64>, content_index: Option<u64>, transcript: String, }, ResponseFunctionCallArgumentsDone { response_id: String, output_index: Option<u64>, name: String, arguments: String, }, ResponseFunctionCallSimpleBrowser { name: String, session: Option<Value>, }, RateLimitsUpdated { rate_limits: Vec<RealtimeRateLimit>, }, Heartbeat, Unknown,
}
Available on crate feature realtime only.
Expand description

A server event, tagged by type.

Extra fields on a known event are ignored. Unknown event types deserialize as ServerEvent::Unknown so a newer server cannot tear down an otherwise healthy session. The enum is non-exhaustive because the server protocol can add event types independently of this crate.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Error

Server-side error (most are recoverable; the session stays open).

Fields

§error: ServerErrorBody

Error detail body.

§

SessionCreated

session.created — session established with effective server defaults.

Fields

§session: RealtimeSessionInfo

Server-created session metadata.

§

SessionUpdated

session.updated — confirms a session.update.

Fields

§session: SessionConfig

Effective server-side session configuration.

§

ConversationCreated

conversation.created — one per session.

Fields

§conversation: RealtimeConversation

Newly created conversation metadata.

§

ConversationItemCreated

conversation.item.created.

Fields

§item: RealtimeConversationItem

The conversation item that was created.

§

ConversationItemDeleted

conversation.item.deleted.

Fields

§item_id: String

Id of the deleted conversation item.

§

ConversationItemRetrieved

conversation.item.retrieved.

Fields

§item: RealtimeConversationItem

Retrieved conversation item.

§

InputAudioTranscriptionCompleted

conversation.item.input_audio_transcription.completed.

Fields

§item_id: String

Id of the transcribed audio item.

§content_index: Option<u64>

Index of the audio content part within the item.

§transcript: String

Transcribed text.

§

InputAudioTranscriptionFailed

conversation.item.input_audio_transcription.failed.

Fields

§item_id: String

Id of the audio item whose transcription failed.

§content_index: Option<u64>

Index of the audio content part within the item.

§error: ServerErrorBody

Error detail body.

§

InputAudioBufferCommitted

input_audio_buffer.committed.

Fields

§item_id: String

Id of the committed audio item.

§

InputAudioBufferCleared

input_audio_buffer.cleared.

§

InputAudioBufferSpeechStarted

input_audio_buffer.speech_started (server-VAD only).

Fields

§audio_start_ms: Option<u64>

Millisecond offset at which speech started, when supplied.

§item_id: Option<String>

Id of the user item created for this speech turn, when supplied.

§

InputAudioBufferSpeechStopped

input_audio_buffer.speech_stopped (server-VAD only).

Fields

§audio_end_ms: Option<u64>

Millisecond offset at which speech stopped, when supplied.

§item_id: Option<String>

Id of the user item created for this speech turn, when supplied.

§

ResponseOutputItemAdded

response.output_item.added — a response output item began streaming.

Fields

§response_id: String

Id of the response that owns the item.

§output_index: u64

Index of the item within the response output.

§item: RealtimeConversationItem

Newly added output item.

§

ResponseOutputItemDone

response.output_item.done — a response output item finished.

Fields

§response_id: String

Id of the response that owns the item.

§output_index: u64

Index of the item within the response output.

§item: RealtimeConversationItem

Final output item.

§

ResponseContentPartAdded

response.content_part.added — a content part began streaming.

Fields

§response_id: String

Id of the response that owns the content part.

§item_id: String

Id of the output item that owns the content part.

§output_index: u64

Index of the output item within the response.

§content_index: u64

Index of the content part within the output item.

§part: ItemContent

Newly added content part.

§

ResponseContentPartDone

response.content_part.done — a content part finished streaming.

Fields

§response_id: String

Id of the response that owns the content part.

§item_id: String

Id of the output item that owns the content part.

§output_index: u64

Index of the output item within the response.

§content_index: u64

Index of the content part within the output item.

§part: ItemContent

Final content part.

§

ResponseCreated

response.created.

Fields

§response: RealtimeResponse

The response object.

§

ResponseDone

response.done — final state + usage. Always emitted.

Fields

§response: RealtimeResponse

The final response object.

§

ResponseCancelled

response.cancelled — confirms cancellation and carries final state.

Fields

§response: RealtimeResponse

The cancelled response object.

§

ResponseTextDelta

response.text.delta — incremental model text.

Fields

§response_id: String

Id of the response this text belongs to.

§item_id: String

Id of the output item.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§content_index: Option<u64>

Index of the content part within the item, when supplied.

§delta: String

Incremental text content.

§

ResponseTextDone

response.text.done — final text for one content part.

Fields

§response_id: String

Id of the response this text belongs to.

§item_id: String

Id of the output item.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§content_index: Option<u64>

Index of the content part within the item, when supplied.

§text: Option<String>

Complete text, when supplied by the server.

§

ResponseAudioDelta

response.audio.delta — base64 24 kHz, mono PCM chunk.

Fields

§response_id: String

Id of the response this chunk belongs to.

§item_id: String

Id of the output item.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§content_index: Option<u64>

Index of the content part within the item, when supplied.

§delta: String

Base64-encoded audio delta.

§

ResponseAudioDone

response.audio.done.

Fields

§response_id: String

Id of the response that finished.

§item_id: String

Id of the output item.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§content_index: Option<u64>

Index of the content part within the item, when supplied.

§

ResponseAudioTranscriptDelta

response.audio_transcript.delta — incremental transcript text.

Fields

§response_id: String

Id of the response this delta belongs to.

§item_id: String

Id of the output item.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§content_index: Option<u64>

Index of the content part within the item, when supplied.

§delta: String

Incremental transcript text.

§

ResponseAudioTranscriptDone

response.audio_transcript.done — final transcript.

Fields

§response_id: String

Id of the response whose transcript completed.

§item_id: String

Id of the output item.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§content_index: Option<u64>

Index of the content part within the item, when supplied.

§transcript: String

Final transcript text.

§

ResponseFunctionCallArgumentsDone

response.function_call_arguments.done — completed tool call.

Fields

§response_id: String

Id of the response that produced the call.

§output_index: Option<u64>

Index of the output item within the response, when supplied.

§name: String

Name of the function/tool to invoke.

§arguments: String

JSON-encoded arguments for the call.

§

ResponseFunctionCallSimpleBrowser

response.function_call.simple_browser — video link triggered search.

Fields

§name: String

Built-in function name (currently "simple_browser").

§session: Option<Value>

Optional server search metadata. This beta payload is open-ended in the upstream schema, so preserve it without inventing a closed type.

§

RateLimitsUpdated

rate_limits.updated — current request quota information.

Fields

§rate_limits: Vec<RealtimeRateLimit>

Current limits reported by the server.

§

Heartbeat

heartbeat — keepalive (every ~30s).

§

Unknown

A valid event type introduced by a newer server.

The event payload is intentionally not retained because it has no stable schema yet. Applications should use a wildcard match arm and upgrade the crate when they need the new event.

Trait Implementations§

Source§

impl Clone for ServerEvent

Source§

fn clone(&self) -> ServerEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServerEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ServerEvent

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more