Truncate Context • Rust AI Agent SDK
truncate_context: Truncate context to fit token limit.
truncate_context
Function
</div>
This function is defined in the rag module.
Truncate context to fit token limit.
Signature
def truncate_context(context: &str, max_tokens: usize) -> StringParameters
ParamField
&strNo description available.
ParamField
usizeNo description available.
Returns
ResponseField
StringThe result of the operation.
Uses
estimate_tokenscharacterminis_char_boundary
Source
View on GitHubpraisonai/src/rag/mod.rs at line 614