Skip to main content
resq_ai > token

Module: token

Contents

Functions

resq_ai::token::estimate_tokens

Function Estimate token count using the chars/4 heuristic.
fn estimate_tokens(text: &str) -> usize

resq_ai::token::truncate_to_budget

Function Truncate text to fit within a token budget. Cuts at line boundaries to avoid broken diff hunks.
fn truncate_to_budget(text: &str, max_tokens: usize) -> &str