Skip to content

Commit

Permalink
Merge pull request #10 from ando-masaki/o1-preview-and-mini-fix
Browse files Browse the repository at this point in the history
Added o1-preview and o1-mini
  • Loading branch information
bluescreen10 authored Nov 22, 2024
2 parents 60becaa + 60153be commit 2ad5811
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tokenizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ package tokenizer
//
// Alternatively you can request a tokenizer using OpenAI's model name, the
// following OpenAI models are supported:
// - O1Preview
// - O1Mini
// - GPT4
// - GPT35Turbo
// - TextEmbeddingAda002
Expand Down Expand Up @@ -92,6 +94,8 @@ type Codec interface {
type Model string

const (
O1Preview Model = "o1-preview"
O1Mini Model = "o1-mini"
GPT4o Model = "gpt-4o"
GPT4 Model = "gpt-4"
GPT35Turbo Model = "gpt-3.5-turbo"
Expand Down Expand Up @@ -140,6 +144,7 @@ const (
)

var modelPrefixToEncoding map[Model]Encoding = map[Model]Encoding{
"o1-": O200kBase,
"gpt-4o-": O200kBase,
"gpt-4-": Cl100kBase,
"gpt-3.5-turbo-": Cl100kBase,
Expand Down Expand Up @@ -176,7 +181,7 @@ func Get(encoding Encoding) (Codec, error) {
// is returned.
func ForModel(model Model) (Codec, error) {
switch model {
case GPT4o:
case O1Preview, O1Mini, GPT4o:
return Get(O200kBase)

case GPT4, GPT35, GPT35Turbo, TextEmbeddingAda002:
Expand Down

0 comments on commit 2ad5811

Please sign in to comment.