pub trait TokenCounter: Send + Sync {
// Required method
fn count_tokens(&self, text: &str) -> usize;
}Expand description
Abstraction for counting tokens in a string.
Implement this trait to plug in an accurate tokenizer such as tiktoken-rs.