pub fn truncate_to_token_limit(text: &str, max_tokens: usize) -> StringExpand description
Truncate string to approximate token limit
Returns a truncated string that fits within the approximate token limit. Tries to truncate at word boundaries when possible to avoid mid-word cuts.