Estimate Tool Schema Tokens • Rust AI Agent SDK
estimate_tool_schema_tokens: Estimate tokens for tool schemas.
estimate_tool_schema_tokens
Function
</div>
This function is defined in the context module.
Estimate tokens for tool schemas.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%
graph LR
agent["Agent"] -- "uses" --> tool["Tool: estimate_tool_schema_tokens"]
tool -- "returns" --> result["Result"]
style tool fill:#189AB4,color:#fff
style agent fill:#8B0000,color:#fff
style result fill:#8B0000,color:#fffSignature
def estimate_tool_schema_tokens(tools: &[serde_json::Value]) -> usizeParameters
ParamField
&[serde_json::Value]No description available.
Returns
ResponseField
usizeThe result of the operation.
Uses
unwrap_or_defaultestimate_tokens_heuristic
Source
View on GitHubpraisonai/src/context/mod.rs at line 344