Skip to main content

estimate_tokens

Function estimate_tokens 

Source
pub fn estimate_tokens(msg: &AgentMessage) -> u64
Expand description

Rough per-message token estimate (~4 chars/token plus a small fixed overhead). Used only to place the cut boundary; the compaction trigger uses provider-reported token counts, never this.