pub enum ServerEvent {
Show 17 variants
SessionCreated {
session: SessionInfo,
},
SessionUpdated {
session: SessionInfo,
},
ConversationCreated {
event_id: String,
conversation: ConversationInfo,
previous_item_id: Option<String>,
},
ResponseAudioDelta {
event_id: String,
response_id: String,
item_id: String,
output_index: u32,
content_index: u32,
delta: String,
},
ResponseOutputAudioDelta {
event_id: String,
response_id: String,
item_id: String,
output_index: u32,
content_index: u32,
delta: String,
},
ResponseFunctionCallArgumentsDelta {
event_id: String,
response_id: String,
item_id: String,
output_index: u32,
call_id: String,
delta: String,
},
ResponseFunctionCallArgumentsDone {
event_id: String,
response_id: String,
item_id: String,
output_index: u32,
call_id: String,
name: String,
arguments: String,
},
ResponseDone {
event_id: String,
response_id: String,
response: Option<ResponseInfo>,
},
InputAudioBufferSpeechStarted {
event_id: String,
audio_start_ms: u64,
item_id: String,
},
InputAudioBufferSpeechStopped {
event_id: String,
audio_end_ms: u64,
item_id: String,
},
InputAudioBufferCommitted {
event_id: String,
item_id: String,
previous_item_id: Option<String>,
},
InputAudioTranscriptionCompleted {
event_id: String,
item_id: String,
transcript: String,
content_index: u32,
status: String,
previous_item_id: Option<String>,
},
ResponseOutputAudioTranscriptDelta {
event_id: String,
item_id: String,
response_id: String,
delta: String,
content_index: u32,
output_index: u32,
start_time: Option<f32>,
previous_item_id: Option<String>,
},
ResponseOutputAudioTranscriptDone {
event_id: String,
item_id: String,
response_id: String,
transcript: String,
content_index: u32,
output_index: u32,
previous_item_id: Option<String>,
},
RateLimitsUpdated {
event_id: String,
rate_limits: Vec<RateLimit>,
},
Error {
event_id: String,
error: ErrorInfo,
},
Unknown,
}Expand description
Events received from Grok server
Variants§
SessionCreated
Session created
Fields
§
session: SessionInfoSessionUpdated
Session updated
Fields
§
session: SessionInfoConversationCreated
Conversation created
ResponseAudioDelta
Audio delta from model response
Fields
ResponseOutputAudioDelta
Alternative event name for audio delta
Fields
ResponseFunctionCallArgumentsDelta
Function call arguments streaming
Fields
ResponseFunctionCallArgumentsDone
Function call arguments complete
Fields
ResponseDone
Response completed
InputAudioBufferSpeechStarted
Speech started in input buffer
InputAudioBufferSpeechStopped
Speech stopped in input buffer
InputAudioBufferCommitted
Input audio buffer committed
InputAudioTranscriptionCompleted
Input audio transcription completed
Fields
ResponseOutputAudioTranscriptDelta
Output audio transcript delta
Fields
ResponseOutputAudioTranscriptDone
Output audio transcript completed
Fields
RateLimitsUpdated
Rate limits updated
Error
Error from server
Unknown
Catch-all for unknown events
Implementations§
Source§impl ServerEvent
impl ServerEvent
Sourcepub fn audio_delta(&self) -> Option<&str>
pub fn audio_delta(&self) -> Option<&str>
Extract audio delta if this is an audio event
Sourcepub fn function_call(&self) -> Option<FunctionCall>
pub fn function_call(&self) -> Option<FunctionCall>
Check if this is a function call completion
Trait Implementations§
Source§impl Clone for ServerEvent
impl Clone for ServerEvent
Source§fn clone(&self) -> ServerEvent
fn clone(&self) -> ServerEvent
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServerEvent
impl Debug for ServerEvent
Source§impl<'de> Deserialize<'de> for ServerEvent
impl<'de> Deserialize<'de> for ServerEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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§
impl Freeze for ServerEvent
impl RefUnwindSafe for ServerEvent
impl Send for ServerEvent
impl Sync for ServerEvent
impl Unpin for ServerEvent
impl UnwindSafe for ServerEvent
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
Mutably borrows from an owned value. Read more