Skip to main content

Tokenizer

Trait Tokenizer 

Source
pub trait Tokenizer: Send + Sync {
    // Required method
    fn count_tokens(&self, text: &str) -> usize;
}
Expand description

Token counter abstraction

Required Methods§

Source

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

Estimate how many model tokens the input text will consume.

Trait Implementations§

Source§

impl Tokenizer for Box<dyn Tokenizer>

Source§

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

Estimate how many model tokens the input text will consume.

Implementations on Foreign Types§

Source§

impl Tokenizer for Box<dyn Tokenizer>

Source§

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

Implementors§