Expand description
Token estimation for mixed-language text
Provides fast token count estimation supporting ASCII, CJK, and other Unicode. Used across the codebase for LLM request sizing, chunking, and content compression.
Structs§
- Token
Estimator - Token estimator for mixed-language text
Constants§
- MESSAGE_
OVERHEAD_ TOKENS - Tokens per message metadata overhead (role, separators, etc.)
- SYMBOL_
FACTOR - Tokens per ASCII symbol (punctuation) character (default: 0.5)
Functions§
- estimate_
tokens - Estimate tokens using default estimator