Skip to main content

ModelTurn

Trait ModelTurn 

Source
pub trait ModelTurn: Send {
    // Required method
    fn next_event<'life0, 'async_trait>(
        &'life0 mut self,
        cancellation: Option<TurnCancellation>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ModelTurnEvent>, LoopError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A streaming model turn that yields events one at a time.

The loop driver calls next_event repeatedly until it returns Ok(None) (stream exhausted) or Ok(Some(ModelTurnEvent::Finished(_))).

Required Methods§

Source

fn next_event<'life0, 'async_trait>( &'life0 mut self, cancellation: Option<TurnCancellation>, ) -> Pin<Box<dyn Future<Output = Result<Option<ModelTurnEvent>, LoopError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve the next event from the model’s response stream.

Returns Ok(None) when the stream is exhausted.

§Errors

Returns LoopError::Cancelled if cancellation fires, or a provider-specific error wrapped in LoopError.

Implementors§