Skip to main content

estimate_tokens

Method
This is a method of the ContextManager class in the manager module.
Estimate tokens with optional validation.

Signature

def estimate_tokens(text: str, validate: bool) -> Tuple[int, Optional[EstimationMetrics]]

Parameters

text
str
required
Text to estimate
validate
bool
default:"False"
Whether to validate against accurate count

Returns

Returns
Tuple[int, Optional[EstimationMetrics]]
Tuple of (token_count, metrics)