Documentation
¶
Index ¶
Constants ¶
View Source
const ( EncodingCl100kBase = "cl100k_base" // GPT-4, GPT-3.5-turbo, embeddings EncodingO200kBase = "o200k_base" // GPT-4o, GPT-4.1, GPT-4.5 EncodingP50kBase = "p50k_base" // Codex models, davinci-002, davinci-003 EncodingR50kBase = "r50k_base" // GPT-3 models )
Encoding names accepted by tiktoken for common model families.
Variables ¶
This section is empty.
Functions ¶
func CountTokens ¶
CountTokens returns the number of tokens in text for the given model.
func EncodingForModel ¶
EncodingForModel maps a model name to the nearest tiktoken encoding. Unknown model families fall back to cl100k_base.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.