pub struct ByteEstimator {
pub bytes_per_token: NonZeroUsize,
pub image_tokens: u64,
}Expand description
Explicit heuristic policy. Image transport bytes are never treated as text. This estimate excludes provider framing and is not a tokenizer count.
Fields§
§bytes_per_token: NonZeroUsize§image_tokens: u64Implementations§
Source§impl ByteEstimator
impl ByteEstimator
Sourcepub fn text_tokens(&self, text: &str) -> u64
pub fn text_tokens(&self, text: &str) -> u64
Round up so nonempty text never disappears from accounting.
Sourcepub fn estimate(&self, request: &ModelRequest) -> RequestEstimate
pub fn estimate(&self, request: &ModelRequest) -> RequestEstimate
Aggregate bytes by the full typed source before rounding each source once. The total is exactly the sum of these non-overlapping categories.
Trait Implementations§
Source§impl Clone for ByteEstimator
impl Clone for ByteEstimator
Source§fn clone(&self) -> ByteEstimator
fn clone(&self) -> ByteEstimator
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ByteEstimator
Source§impl Debug for ByteEstimator
impl Debug for ByteEstimator
Source§impl Default for ByteEstimator
impl Default for ByteEstimator
Source§impl<'de> Deserialize<'de> for ByteEstimator
impl<'de> Deserialize<'de> for ByteEstimator
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ByteEstimator
Source§impl JsonSchema for ByteEstimator
impl JsonSchema for ByteEstimator
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ByteEstimator
impl PartialEq for ByteEstimator
Source§fn eq(&self, other: &ByteEstimator) -> bool
fn eq(&self, other: &ByteEstimator) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ByteEstimator
impl Serialize for ByteEstimator
impl StructuralPartialEq for ByteEstimator
Auto Trait Implementations§
impl Freeze for ByteEstimator
impl RefUnwindSafe for ByteEstimator
impl Send for ByteEstimator
impl Sync for ByteEstimator
impl Unpin for ByteEstimator
impl UnsafeUnpin for ByteEstimator
impl UnwindSafe for ByteEstimator
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