Skip to content

Commit

Permalink
Update OpenAI token limits chart. (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
crspeller authored Oct 15, 2024
1 parent 013ad2f commit 1aa81f7
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions server/ai/openai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,22 @@ func (s *OpenAI) TokenLimit() int {
}

switch {
case strings.HasPrefix(s.defaultModel, "gpt-4-32k"):
return 32768
case strings.HasPrefix(s.defaultModel, "gpt-4o"),
strings.HasPrefix(s.defaultModel, "o1-preview"),
strings.HasPrefix(s.defaultModel, "o1-mini"),
strings.HasPrefix(s.defaultModel, "gpt-4-turbo"),
strings.HasPrefix(s.defaultModel, "gpt-4-0125-preview"),
strings.HasPrefix(s.defaultModel, "gpt-4-1106-preview"):
return 128000
case strings.HasPrefix(s.defaultModel, "gpt-4"):
return 8192
case strings.HasPrefix(s.defaultModel, "gpt-3.5-turbo-16k"):
return 16384
case strings.HasPrefix(s.defaultModel, "gpt-3.5-turbo"):
case strings.HasPrefix(s.defaultModel, "gpt-3.5-turbo"),
s.defaultModel == "gpt-3.5-turbo-0125",
s.defaultModel == "gpt-3.5-turbo-1106":
return 16385
case s.defaultModel == "gpt-3.5-turbo-instruct":
return 4096
}

return 4096
return 128000 // Default fallback
}

0 comments on commit 1aa81f7

Please sign in to comment.