Skip to main content

TokenCounter

Trait TokenCounter 

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

Trait for measuring token counts of text slices.

Required Methods§

Source

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

Return the measured or estimated token count for the given text.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§