Skip to main content

encoding_for_model

Function encoding_for_model 

Source
pub fn encoding_for_model(model: &str) -> Result<Encoding, JsError>
Expand description

Get an encoding for a model name (e.g. "gpt-4o", "o3-mini", "llama-4", "deepseek-r1").

Supports models from OpenAI, Meta, DeepSeek, Qwen, and Mistral. Automatically resolves the model name to the correct encoding. Throws Error for unknown model names.