Skip to main content

encode

Function encode 

Source
pub fn encode(text: &str) -> Result<Vec<u32>, Error>
Expand description

Returns the ordinary token IDs of o200k_base, including for literal special markers.

ยงErrors

Returns Error::InputTooLarge before initialization or tokenization if the UTF-8 input exceeds MAX_INPUT_BYTES, Error::Internal if initialization fails, and Error::Tokenization if the tokenizer cannot segment the input.