Skip to main content

TokenCountExt

Trait TokenCountExt 

Source
pub trait TokenCountExt {
    // Required methods
    fn token_count(&self, model: ModelType) -> TokenInfo;
    fn token_counts(&self) -> HashMap<ModelType, TokenInfo>;
}
Expand description

Extension trait for adding token counting to dx format serializer

Required Methods§

Source

fn token_count(&self, model: ModelType) -> TokenInfo

Get token count for the serialized output

Source

fn token_counts(&self) -> HashMap<ModelType, TokenInfo>

Get token counts for all models

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl TokenCountExt for String

Source§

impl TokenCountExt for str

Implementors§