SessionWriter

Trait SessionWriter 

Source
pub trait SessionWriter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn send_audio<'life0, 'async_trait>(
        &'life0 self,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_text<'life0, 'async_trait>(
        &'life0 self,
        text: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_tool_response<'life0, 'async_trait>(
        &'life0 self,
        responses: Vec<FunctionResponse>,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_client_content<'life0, 'async_trait>(
        &'life0 self,
        turns: Vec<Content>,
        turn_complete: bool,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_video<'life0, 'async_trait>(
        &'life0 self,
        jpeg_data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_instruction<'life0, 'async_trait>(
        &'life0 self,
        instruction: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn signal_activity_start<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn signal_activity_end<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn disconnect<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Write-side of a session — send commands without owning the full handle.

Required Methods§

Source

fn send_audio<'life0, 'async_trait>( &'life0 self, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send raw PCM16 audio bytes.

Source

fn send_text<'life0, 'async_trait>( &'life0 self, text: String, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a text message.

Source

fn send_tool_response<'life0, 'async_trait>( &'life0 self, responses: Vec<FunctionResponse>, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send tool/function call responses back to the model.

Source

fn send_client_content<'life0, 'async_trait>( &'life0 self, turns: Vec<Content>, turn_complete: bool, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send client content (conversation history or context).

Source

fn send_video<'life0, 'async_trait>( &'life0 self, jpeg_data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a video/image frame (raw JPEG bytes).

Source

fn update_instruction<'life0, 'async_trait>( &'life0 self, instruction: String, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Update the system instruction mid-session.

Source

fn signal_activity_start<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signal that user speech activity has started.

Source

fn signal_activity_end<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signal that user speech activity has ended.

Source

fn disconnect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gracefully disconnect the session.

Implementors§