Skip to main content

parse_usage_event

Function parse_usage_event 

Source
fn parse_usage_event(parsed: &Value) -> Option<LlmStreamEvent>
Expand description

Parse a top-level usage object into a LlmStreamEvent::Usage event.

Returns None when the frame carries no usage field. Deliberately returns just the event (not a full SseParseResult) — unlike parse_inline_error_frame, a usage field does not imply the rest of the frame should be skipped. See the call site in parse_sse_frame for why.