Skip to main content

estimate_tokens

Function estimate_tokens 

Source
pub fn estimate_tokens(text: &str) -> usize
Expand description

Estimate token count from string (rough approximation)

Simple estimation: 1 token ≈ 4 characters. Returns a minimum of 1 for non-empty strings.