pub struct Estimate;Expand description
The default token estimate: pessimistic, and deterministic.
§How it counts
Three bytes per token, rounded up, plus one token per line. Real byte-level BPE averages closer to four bytes per token on prose and rather worse on dense punctuation, which is most of what a slicer handles — code, diffs, and JSON. The per-line term is there because newlines and the indentation after them tokenise poorly and a slicer’s output is unusually line-dense.
It is an estimate and says so. What matters is the direction of its error:
over-estimating costs a little unused window, under-estimating overruns
s_max and breaks Law II after the call has been paid for.
Trait Implementations§
impl Copy for Estimate
impl Eq for Estimate
impl StructuralPartialEq for Estimate
Auto Trait Implementations§
impl Freeze for Estimate
impl RefUnwindSafe for Estimate
impl Send for Estimate
impl Sync for Estimate
impl Unpin for Estimate
impl UnsafeUnpin for Estimate
impl UnwindSafe for Estimate
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