pub async fn drive_conversation_stream<S, F>(
stream: S,
on_event: F,
) -> Result<ConversationResponse>where
S: Stream<Item = Result<ConversationStreamEvent>> + Send + Unpin,
F: FnMut(ConversationStreamEvent) + Send,Expand description
Drive a conversation event stream to completion, invoking on_event for
every event, and returning the final ConversationResponse once a
ConversationStreamEvent::WorkflowFinished or
ConversationStreamEvent::HumanInteractionRequired event is observed
(or an error if the stream ends before either happens). An interrupted
run emits HumanInteractionRequired instead of WorkflowFinished, never
both, so exactly one of the two is expected per run.
Used by binding layers that are call-scoped-callback shaped (C, C++,
Node.js) — every other binding either pulls synchronously
(conversation_stream_iter) or drives with real backpressure
(ConversationStreamSubscription).