pub enum MeasurementSource {
Native {
provider: String,
},
LocalExact {
tokenizer: String,
},
Heuristic,
}Expand description
Where a token count came from — never just a bare u32, so a caller can tell “the provider’s
own count API said so” apart from “we guessed.” The provenance remains part of the reserved
contract, but no runtime currently persists or consumes this fact.
Variants§
Native
The provider’s own token-counting endpoint answered (e.g. Anthropic
messages/count_tokens, OpenAI Responses token counting, Gemini countTokens).
LocalExact
A real BPE tokenizer ran locally, but against a vocabulary that may not be the target
provider’s own (e.g. cl100k standing in for a non-OpenAI vendor) — see
FallbackEstimator (spc_011-C-01) for the concrete counter this describes.
Heuristic
No tokenizer ran at all; this is a coarse guess with a generous safety margin.
Trait Implementations§
Source§impl Clone for MeasurementSource
impl Clone for MeasurementSource
Source§fn clone(&self) -> MeasurementSource
fn clone(&self) -> MeasurementSource
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 moreSource§impl Debug for MeasurementSource
impl Debug for MeasurementSource
Source§impl<'de> Deserialize<'de> for MeasurementSource
impl<'de> Deserialize<'de> for MeasurementSource
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<MeasurementSource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<MeasurementSource, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for MeasurementSource
impl PartialEq for MeasurementSource
Source§impl Serialize for MeasurementSource
impl Serialize for MeasurementSource
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for MeasurementSource
Auto Trait Implementations§
impl Freeze for MeasurementSource
impl RefUnwindSafe for MeasurementSource
impl Send for MeasurementSource
impl Sync for MeasurementSource
impl Unpin for MeasurementSource
impl UnsafeUnpin for MeasurementSource
impl UnwindSafe for MeasurementSource
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