pub trait Tokenizer {
// Required method
fn count_tokens(&self, text: &str) -> u32;
}Expand description
Trait for counting tokens in text. Implement this to integrate with specific tokenizers (e.g., tiktoken, HuggingFace tokenizers).
Required Methods§
Sourcefn count_tokens(&self, text: &str) -> u32
fn count_tokens(&self, text: &str) -> u32
Count the number of tokens in the given text.