Skip to main content

is_context_overflow

Function is_context_overflow 

Source
pub fn is_context_overflow(
    error_message: &str,
    usage_input_tokens: Option<u64>,
    context_window: Option<u32>,
) -> bool
Expand description

Check whether an error message indicates the prompt exceeded the context window. Matches the 15 pi-mono overflow patterns plus Cerebras/Mistral status code pattern.

Also detects “silent” overflow when usage_input_tokens exceeds context_window.