Skip to content

Commit

Permalink
Add ChatGPT 4o (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
svilupp authored Aug 14, 2024
1 parent 8f697f6 commit a2cde30
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [0.49.0]

### Added
- Added new OpenAI's model "chatgpt-4o-latest" to the model registry with alias "chatgpt". This model represents the latest version of ChatGPT-4o tuned specifically for ChatGPT.

## [0.48.0]

### Added
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PromptingTools"
uuid = "670122d1-24a8-4d70-bfce-740807c42192"
authors = ["J S @svilupp and contributors"]
version = "0.48.0"
version = "0.49.0"

[deps]
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
Expand Down
45 changes: 45 additions & 0 deletions src/llm_openai.jl
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,51 @@ const OPENAI_TOKEN_IDS = Dict("true" => 837,
"39" => 2137,
"40" => 1272
)
# GPT-4o token IDs as per tiktoken
# "true": 3309,
# "false": 7556,
# "unknown": 33936,
# "other": 2141,
# "1": 16,
# "2": 17,
# "3": 18,
# "4": 19,
# "5": 20,
# "6": 21,
# "7": 22,
# "8": 23,
# "9": 24,
# "10": 702,
# "11": 994,
# "12": 899,
# "13": 1311,
# "14": 1265,
# "15": 1055,
# "16": 1125,
# "17": 1422,
# "18": 1157,
# "19": 858,
# "20": 455,
# "21": 2040,
# "22": 1709,
# "23": 1860,
# "24": 1494,
# "25": 1161,
# "26": 2109,
# "27": 2092,
# "28": 2029,
# "29": 2270,
# "30": 1130,
# "31": 2911,
# "32": 1398,
# "33": 2546,
# "34": 3020,
# "35": 2467,
# "36": 2636,
# "37": 2991,
# "38": 3150,
# "39": 3255,
# "40": 1723,

"""
encode_choices(schema::OpenAISchema, choices::AbstractVector{<:AbstractString}; kwargs...)
Expand Down
6 changes: 6 additions & 0 deletions src/user_preferences.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ aliases = merge(
"gpt4v" => "gpt-4-vision-preview", # 4v is for "4 vision"
"gpt4t" => "gpt-4-turbo", # 4t is for "4 turbo"
"gpt3t" => "gpt-3.5-turbo-0125", # 3t is for "3 turbo"
"chatgpt" => "chatgpt-4o-latest",
"ada" => "text-embedding-ada-002",
"emb3small" => "text-embedding-3-small",
"emb3large" => "text-embedding-3-large",
Expand Down Expand Up @@ -467,6 +468,11 @@ registry = Dict{String, ModelSpec}(
1.5e-7,
6e-7,
"GPT-4 Omni Mini, the smallest and fastest model based on GPT4 (and cheaper than GPT3.5Turbo). Context of 128K, knowledge until October 2023. Currently points to version gpt-4o-2024-07-18."),
"chatgpt-4o-latest" => ModelSpec("chatgpt-4o-latest",
OpenAISchema(),
5e-6,
1.5e-5,
"ChatGPT-4o-latest is the latest version of ChatGPT-4o tuned for ChatGPT. It is the NOT same as gpt-4o-latest."),
"gpt-4-vision-preview" => ModelSpec(
"gpt-4-vision-preview",
OpenAISchema(),
Expand Down

0 comments on commit a2cde30

Please sign in to comment.