pub trait LiveConnection: Send + Sync {
// Required methods
fn send_history<'life0, 'life1, 'async_trait>(
&'life0 self,
history: &'life1 [Content],
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_content<'life0, 'async_trait>(
&'life0 self,
content: Content,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn send_realtime<'life0, 'async_trait>(
&'life0 self,
input: RealtimeInput,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn recv<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<LlmResponse>, LiveConnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A live (bidi streaming) connection to a model, model-agnostic. recv must be cancel-safe
and may run concurrently with a send.
Required Methods§
Sourcefn send_history<'life0, 'life1, 'async_trait>(
&'life0 self,
history: &'life1 [Content],
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_history<'life0, 'life1, 'async_trait>(
&'life0 self,
history: &'life1 [Content],
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sends the earlier conversation turns to the model.
Sourcefn send_content<'life0, 'async_trait>(
&'life0 self,
content: Content,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_content<'life0, 'async_trait>(
&'life0 self,
content: Content,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends one content turn.
Sourcefn send_realtime<'life0, 'async_trait>(
&'life0 self,
input: RealtimeInput,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_realtime<'life0, 'async_trait>(
&'life0 self,
input: RealtimeInput,
) -> Pin<Box<dyn Future<Output = Result<(), LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sends realtime input (audio or image data, or an activity marker).
Sourcefn recv<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<LlmResponse>, LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<LlmResponse>, LiveConnError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receives the next response. Ok(None): the stream ended without a close frame (callers
treat it as LiveConnError::eof). A received close frame is Err with kind
Closed { code }.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".