Skip to main content

drive_turn

Function drive_turn 

Source
pub async fn drive_turn<S>(
    stream: S,
    model: &str,
    totals: &mut SessionTotals,
    on_event: impl FnMut(&StreamEvent, &SessionTotals),
) -> TurnReport
where S: Stream<Item = StreamEvent> + Unpin,
Expand description

Drain one turn’s stream, metering it into totals. model prices usage events that do not name their model. on_event sees every event after it was metered (for logging).