#[non_exhaustive]pub enum TiktokenEncoding {
Cl100kBase,
O200kBase,
P50kBase,
R50kBase,
}Expand description
OpenAI BPE encoding family. Pick the variant matching the target model — see the crate-level docs for the model-to-encoding table.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Cl100kBase
cl100k_base — GPT-3.5-turbo, GPT-4, GPT-4-turbo, the
text-embedding-3-* family.
O200kBase
o200k_base — GPT-4o, GPT-4o-mini, o1, o3, o3-mini, o4.
P50kBase
p50k_base — GPT-3 davinci, codex.
R50kBase
r50k_base — GPT-3 ada / babbage / curie + the original GPT-2
tokenizer.
Implementations§
Source§impl TiktokenEncoding
impl TiktokenEncoding
Sourcepub const fn name(self) -> &'static str
pub const fn name(self) -> &'static str
Canonical encoding name as published by OpenAI’s tiktoken
reference implementation. Surfaces on
TokenCounter::encoding_name and the OTel
gen_ai.tokenizer.name attribute.
Trait Implementations§
Source§impl Clone for TiktokenEncoding
impl Clone for TiktokenEncoding
Source§fn clone(&self) -> TiktokenEncoding
fn clone(&self) -> TiktokenEncoding
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 TiktokenEncoding
impl Debug for TiktokenEncoding
Source§impl Hash for TiktokenEncoding
impl Hash for TiktokenEncoding
Source§impl PartialEq for TiktokenEncoding
impl PartialEq for TiktokenEncoding
Source§fn eq(&self, other: &TiktokenEncoding) -> bool
fn eq(&self, other: &TiktokenEncoding) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for TiktokenEncoding
impl Eq for TiktokenEncoding
impl StructuralPartialEq for TiktokenEncoding
Auto Trait Implementations§
impl Freeze for TiktokenEncoding
impl RefUnwindSafe for TiktokenEncoding
impl Send for TiktokenEncoding
impl Sync for TiktokenEncoding
impl Unpin for TiktokenEncoding
impl UnsafeUnpin for TiktokenEncoding
impl UnwindSafe for TiktokenEncoding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.