Skip to main content

definitely_fits_token_budget

Function definitely_fits_token_budget 

Source
pub fn definitely_fits_token_budget(text: &str, max_tokens: usize) -> bool
Expand description

Return true when byte length alone proves text fits the token budget.

The embedded tokenizer is byte-level BPE without added special tokens, so it cannot emit more tokens than the number of UTF-8 input bytes. This conservative fast path avoids loading or running the tokenizer for small payloads while exact tokenization remains in charge near and above the budget boundary.