pub struct TokenCounter;Expand description
Token counting utilities
Implementations§
Source§impl TokenCounter
impl TokenCounter
Sourcepub fn count_tokens(text: &str) -> i32
pub fn count_tokens(text: &str) -> i32
Count tokens in text using GPT-style approximation This provides a rough estimate - for actual tokenization, use a proper tokenizer
Sourcepub fn count_tokens_detailed(text: &str) -> TokenCounts
pub fn count_tokens_detailed(text: &str) -> TokenCounts
Count tokens with detailed breakdown for debugging
Auto Trait Implementations§
impl Freeze for TokenCounter
impl RefUnwindSafe for TokenCounter
impl Send for TokenCounter
impl Sync for TokenCounter
impl Unpin for TokenCounter
impl UnwindSafe for TokenCounter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more