Skip to main content

Tokenizer

Trait Tokenizer 

Source
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§

Source

fn count_tokens(&self, text: &str) -> u32

Count the number of tokens in the given text.

Implementors§