pub struct HeuristicTokenCounter { /* private fields */ }Expand description
Estimates token cost from UTF-8 lengths, rounded up per text-bearing part. Tool calls count name bytes plus serialized argument bytes. Attachments and message overhead have fixed costs. These estimates do not bound provider usage.
use rig_memory::{HeuristicTokenCounter, TokenWindowMemory};
let policy = TokenWindowMemory::new(2_000, HeuristicTokenCounter::default());Implementations§
Trait Implementations§
Source§impl Clone for HeuristicTokenCounter
impl Clone for HeuristicTokenCounter
impl Copy for HeuristicTokenCounter
Source§impl Debug for HeuristicTokenCounter
impl Debug for HeuristicTokenCounter
Source§impl Default for HeuristicTokenCounter
impl Default for HeuristicTokenCounter
Source§impl TokenCounter for HeuristicTokenCounter
impl TokenCounter for HeuristicTokenCounter
Auto Trait Implementations§
impl Freeze for HeuristicTokenCounter
impl RefUnwindSafe for HeuristicTokenCounter
impl Send for HeuristicTokenCounter
impl Sync for HeuristicTokenCounter
impl Unpin for HeuristicTokenCounter
impl UnsafeUnpin for HeuristicTokenCounter
impl UnwindSafe for HeuristicTokenCounter
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