Documentation ¶
Index ¶
Constants ¶
View Source
const ( MODEL_CL100K_BASE string = "cl100k_base" MODEL_P50K_BASE string = "p50k_base" MODEL_P50K_EDIT string = "p50k_edit" MODEL_R50K_BASE string = "r50k_base" )
View Source
const ENDOFPROMPT string = "<|endofprompt|>"
View Source
const ENDOFTEXT string = "<|endoftext|>"
View Source
const FIM_MIDDLE string = "<|fim_middle|>"
View Source
const FIM_PREFIX string = "<|fim_prefix|>"
View Source
const FIM_SUFFIX string = "<|fim_suffix|>"
Variables ¶
View Source
var MODEL_PREFIX_TO_ENCODING = map[string]string{ "gpt-4-": MODEL_CL100K_BASE, "gpt-3.5-turbo-": MODEL_CL100K_BASE, }
View Source
var MODEL_TO_ENCODING = map[string]string{ "gpt-4": MODEL_CL100K_BASE, "gpt-3.5-turbo": MODEL_CL100K_BASE, "text-davinci-003": MODEL_P50K_BASE, "text-davinci-002": MODEL_P50K_BASE, "text-davinci-001": MODEL_R50K_BASE, "text-curie-001": MODEL_R50K_BASE, "text-babbage-001": MODEL_R50K_BASE, "text-ada-001": MODEL_R50K_BASE, "davinci": MODEL_R50K_BASE, "curie": MODEL_R50K_BASE, "babbage": MODEL_R50K_BASE, "ada": MODEL_R50K_BASE, "code-davinci-002": MODEL_P50K_BASE, "code-davinci-001": MODEL_P50K_BASE, "code-cushman-002": MODEL_P50K_BASE, "code-cushman-001": MODEL_P50K_BASE, "davinci-codex": MODEL_P50K_BASE, "cushman-codex": MODEL_P50K_BASE, "text-davinci-edit-001": MODEL_P50K_EDIT, "code-davinci-edit-001": MODEL_P50K_EDIT, "text-embedding-ada-002": MODEL_CL100K_BASE, "text-similarity-davinci-001": MODEL_R50K_BASE, "text-similarity-curie-001": MODEL_R50K_BASE, "text-similarity-babbage-001": MODEL_R50K_BASE, "text-similarity-ada-001": MODEL_R50K_BASE, "text-search-davinci-doc-001": MODEL_R50K_BASE, "text-search-curie-doc-001": MODEL_R50K_BASE, "text-search-babbage-doc-001": MODEL_R50K_BASE, "text-search-ada-doc-001": MODEL_R50K_BASE, "code-search-babbage-code-001": MODEL_R50K_BASE, "code-search-ada-code-001": MODEL_R50K_BASE, "gpt2": "gpt2", }
Functions ¶
func SetBpeLoader ¶
func SetBpeLoader(loader BpeLoader)
Types ¶
type BpeLoader ¶
func NewDefaultBpeLoader ¶
func NewDefaultBpeLoader() BpeLoader
type Tiktoken ¶
type Tiktoken struct {
// contains filtered or unexported fields
}
func EncodingForModel ¶
func GetEncoding ¶
func NewTiktoken ¶
NewTiktoken can be used to create a *Tiktoken with custom parameters.
func (*Tiktoken) EncodeOrdinary ¶
Click to show internal directories.
Click to hide internal directories.