pub enum ClientMessage {
StartSession {
pre_prompt: Option<String>,
language: Option<String>,
pipeline_mode: Option<String>,
ai_speaks_first: Option<bool>,
allow_harm_category: Option<bool>,
tools: Option<Vec<Tool>>,
},
EndSession,
AudioStart,
AudioChunk {
data: String,
},
AudioEnd,
SystemMessage {
payload: SystemMessagePayload,
},
ToolResponse {
payload: ToolResponsePayload,
},
UpdateUserId {
user_id: String,
},
Interrupt,
Ping,
}Expand description
Client message types (sent from client to server)
Variants§
StartSession
Start a new session
Fields
EndSession
End the current session
AudioStart
Start audio streaming session
AudioChunk
Send audio chunk
AudioEnd
End audio streaming session
SystemMessage
Send a system message to the AI during a live session
Fields
payload: SystemMessagePayloadSystem message payload
ToolResponse
Send tool response (function execution result) back to AI
Fields
payload: ToolResponsePayloadTool response payload
UpdateUserId
Update user ID (guest-to-user migration)
Interrupt
Explicit interrupt (stop AI response)
Ping
Ping for keep-alive
Implementations§
Source§impl ClientMessage
impl ClientMessage
Sourcepub fn start_session(
pre_prompt: Option<String>,
language: Option<String>,
pipeline_mode: Option<String>,
ai_speaks_first: Option<bool>,
allow_harm_category: Option<bool>,
tools: Option<Vec<Tool>>,
) -> Self
pub fn start_session( pre_prompt: Option<String>, language: Option<String>, pipeline_mode: Option<String>, ai_speaks_first: Option<bool>, allow_harm_category: Option<bool>, tools: Option<Vec<Tool>>, ) -> Self
Create a start session message
Sourcepub fn end_session() -> Self
pub fn end_session() -> Self
Create an end session message
Sourcepub fn audio_start() -> Self
pub fn audio_start() -> Self
Create an audio start message
Sourcepub fn audio_chunk(data: impl Into<String>) -> Self
pub fn audio_chunk(data: impl Into<String>) -> Self
Create an audio chunk message
Sourcepub fn system_message(text: impl Into<String>) -> Self
pub fn system_message(text: impl Into<String>) -> Self
Create a system message (AI responds immediately)
Sourcepub fn system_message_with_options(
text: impl Into<String>,
trigger_response: bool,
) -> Self
pub fn system_message_with_options( text: impl Into<String>, trigger_response: bool, ) -> Self
Create a system message with explicit trigger_response option
Sourcepub fn tool_response(id: impl Into<String>, response: Value) -> Self
pub fn tool_response(id: impl Into<String>, response: Value) -> Self
Create a tool response message (function execution result)
Sourcepub fn update_user_id(user_id: impl Into<String>) -> Self
pub fn update_user_id(user_id: impl Into<String>) -> Self
Create an update user ID message (guest-to-user migration)
Trait Implementations§
Source§impl Clone for ClientMessage
impl Clone for ClientMessage
Source§fn clone(&self) -> ClientMessage
fn clone(&self) -> ClientMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more