estimate_tokens
Method
This is a method of the ContextManager class in the manager module.Estimate tokens with optional validation.
Signature
Parameters
str
required
Text to estimate
bool
default:"False"
Whether to validate against accurate count
Returns
Tuple[int, Optional[EstimationMetrics]]
Tuple of (token_count, metrics)
Uses
hexdigesthashlib.md5text.encodeestimate_tokens_heuristicestimate_tokens_accurateEstimationMetricswarninglogging.getLogger
Used By
Source
View on GitHub
praisonaiagents/context/manager.py at line 707
