pub struct HeuristicCounter;Expand description
The engine’s default TokenCounter: everything above, behind the
contract, so a host with a better answer can supply one.
Stateless, so constructing one costs nothing and any number of them agree.
Trait Implementations§
Source§impl Clone for HeuristicCounter
impl Clone for HeuristicCounter
impl Copy for HeuristicCounter
Source§impl Debug for HeuristicCounter
impl Debug for HeuristicCounter
Source§impl Default for HeuristicCounter
impl Default for HeuristicCounter
Source§impl TokenCounter for HeuristicCounter
impl TokenCounter for HeuristicCounter
Source§fn count_text(&self, text: &str) -> usize
fn count_text(&self, text: &str) -> usize
Tokens in a plain string.
Source§fn count_block(&self, block: &ModelContentBlock) -> usize
fn count_block(&self, block: &ModelContentBlock) -> usize
Tokens in one content block, including whatever that block type costs
beyond its text.
Source§fn count_messages(&self, messages: &[ModelMessage]) -> usize
fn count_messages(&self, messages: &[ModelMessage]) -> usize
Tokens in a conversation. Read more
Auto Trait Implementations§
impl Forget for HeuristicCounter
impl Freeze for HeuristicCounter
impl Move for HeuristicCounter
impl RefUnwindSafe for HeuristicCounter
impl Send for HeuristicCounter
impl Sync for HeuristicCounter
impl Unpin for HeuristicCounter
impl UnsafeUnpin for HeuristicCounter
impl UnwindSafe for HeuristicCounter
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