Enum ContextDelivery
pub enum ContextDelivery {
Immediate,
Deferred,
}Expand description
When to deliver model-role context turns to the wire.
Controls timing of context injection (tool advisory, repair nudge, steering modifiers, phase instructions, on_enter_context).
| Mode | Behavior | Best for |
|---|---|---|
Immediate | Send as single batched frame during TurnComplete | Low-latency apps, text-only |
Deferred | Queue until next user send (audio/text/video) | Voice apps where mid-silence sends cause glitches |
§Example
Live::builder()
.steering_mode(SteeringMode::ContextInjection)
.context_delivery(ContextDelivery::Deferred) // flush with next user audio
.phase("greeting")
.instruction("Welcome the guest")
.done()
.initial_phase("greeting")Variants§
Immediate
Send batched context immediately during TurnComplete processing.
All context turns are accumulated into a single send_client_content
call and sent as one WebSocket frame. The model receives the context
as soon as the turn completes, before the next user interaction.
Deferred
Queue context and flush before the next user send.
Context turns are pushed into a PendingContext
buffer. The DeferredWriter
drains this buffer before forwarding send_audio, send_text, or
send_video — ensuring context arrives in the same burst as user content.
This eliminates the “extraneous message” problem where isolated context frames sent during silence can cause the model to interrupt or produce unexpected responses.
Trait Implementations§
§impl Clone for ContextDelivery
impl Clone for ContextDelivery
§fn clone(&self) -> ContextDelivery
fn clone(&self) -> ContextDelivery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ContextDelivery
impl Debug for ContextDelivery
§impl Default for ContextDelivery
impl Default for ContextDelivery
§fn default() -> ContextDelivery
fn default() -> ContextDelivery
§impl PartialEq for ContextDelivery
impl PartialEq for ContextDelivery
impl Copy for ContextDelivery
impl Eq for ContextDelivery
impl StructuralPartialEq for ContextDelivery
Auto Trait Implementations§
impl Freeze for ContextDelivery
impl RefUnwindSafe for ContextDelivery
impl Send for ContextDelivery
impl Sync for ContextDelivery
impl Unpin for ContextDelivery
impl UnwindSafe for ContextDelivery
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.