pub enum ClientEvent {
SessionUpdate {
event_id: Option<String>,
session: SessionConfig,
},
InputAudioBufferAppend {
event_id: Option<String>,
audio: String,
},
InputAudioBufferClear {
event_id: Option<String>,
},
InputAudioBufferCommit {
event_id: Option<String>,
},
OutputAudioBufferClear {
event_id: Option<String>,
},
ConversationItemCreate {
event_id: Option<String>,
previous_item_id: Option<String>,
item: ConversationItem,
},
ConversationItemDelete {
event_id: Option<String>,
item_id: String,
},
ConversationItemRetrieve {
event_id: Option<String>,
item_id: String,
},
ConversationItemTruncate {
event_id: Option<String>,
item_id: String,
content_index: u32,
audio_end_ms: u32,
},
ResponseCreate {
event_id: Option<String>,
response: Option<ResponseCreateConfig>,
},
ResponseCancel {
event_id: Option<String>,
},
}Expand description
Client events sent to the OpenAI Realtime API server.
Variants§
SessionUpdate
Update the session configuration.
Fields
session: SessionConfigSession configuration to update.
InputAudioBufferAppend
Append audio data to the input buffer.
Fields
InputAudioBufferClear
Clear the input audio buffer.
InputAudioBufferCommit
Commit the input audio buffer.
OutputAudioBufferClear
Clear the output audio buffer (WebRTC only).
ConversationItemCreate
Create a new conversation item.
Fields
item: ConversationItemThe conversation item to create.
ConversationItemDelete
Delete a conversation item.
Fields
ConversationItemRetrieve
Retrieve a conversation item.
Fields
ConversationItemTruncate
Truncate a conversation item’s audio.
Fields
ResponseCreate
Create a new response.
Fields
ResponseCancel
Cancel the current response.
Implementations§
Source§impl ClientEvent
impl ClientEvent
Sourcepub fn session_update(config: SessionConfig) -> Self
pub fn session_update(config: SessionConfig) -> Self
Create a session update event.
Sourcepub fn append_audio(audio_base64: impl Into<String>) -> Self
pub fn append_audio(audio_base64: impl Into<String>) -> Self
Create an input audio buffer append event.
Sourcepub fn clear_audio() -> Self
pub fn clear_audio() -> Self
Create an input audio buffer clear event.
Sourcepub fn commit_audio() -> Self
pub fn commit_audio() -> Self
Create an input audio buffer commit event.
Sourcepub fn create_item(item: ConversationItem) -> Self
pub fn create_item(item: ConversationItem) -> Self
Create a conversation item create event.
Sourcepub fn create_item_after(
item: ConversationItem,
previous_item_id: impl Into<String>,
) -> Self
pub fn create_item_after( item: ConversationItem, previous_item_id: impl Into<String>, ) -> Self
Create a conversation item create event with a specific position.
Sourcepub fn delete_item(item_id: impl Into<String>) -> Self
pub fn delete_item(item_id: impl Into<String>) -> Self
Create a conversation item delete event.
Sourcepub fn create_response(config: Option<ResponseCreateConfig>) -> Self
pub fn create_response(config: Option<ResponseCreateConfig>) -> Self
Create a response create event.
Sourcepub fn cancel_response() -> Self
pub fn cancel_response() -> Self
Create a response cancel event.
Sourcepub fn with_event_id(self, id: impl Into<String>) -> Self
pub fn with_event_id(self, id: impl Into<String>) -> Self
Set a custom event ID.
Trait Implementations§
Source§impl Clone for ClientEvent
impl Clone for ClientEvent
Source§fn clone(&self) -> ClientEvent
fn clone(&self) -> ClientEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more