Estimate Tokens Heuristic • Rust AI Agent SDK
estimate_tokens_heuristic: Estimate tokens for a string using heuristic (4 chars ≈ 1 token).
estimate_tokens_heuristic
Function
</div>
This function is defined in the context module.
Estimate tokens for a string using heuristic (4 chars ≈ 1 token).
Signature
def estimate_tokens_heuristic(text: &str) -> usizeParameters
ParamField
&strNo description available.
Returns
ResponseField
usizeThe result of the operation.
Uses
average
Source
View on GitHubpraisonai/src/context/mod.rs at line 319