Skip to main content

extract_context_usage

Function extract_context_usage 

Source
pub fn extract_context_usage(messages: &[Value]) -> Option<ContextUsage>
Expand description

Fold a run’s context usage: the last request’s fill, the peak fill, the model’s context window when reported, and the compaction count.

Returns None when the run reported no token usage.