Skip to content

Commit

Permalink
Add missing o1 models
Browse files Browse the repository at this point in the history
  • Loading branch information
dqbd committed Oct 3, 2024
1 parent f8aa455 commit 0ba7dbb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
10 changes: 9 additions & 1 deletion js/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,15 @@ export function getEncodingNameForModel(model: TiktokenModel) {
case "gpt-4o-2024-05-13":
case "gpt-4o-2024-08-06":
case "gpt-4o-mini-2024-07-18":
case "gpt-4o-mini": {
case "gpt-4o-mini":
case "o1-mini":
case "o1-preview":
case "o1-preview-2024-09-12":
case "o1-mini-2024-09-12":
case "chatgpt-4o-latest":
case "gpt-4o-realtime":
case "gpt-4o-realtime-preview-2024-10-01":
{
return "o200k_base";
}
default:
Expand Down
9 changes: 8 additions & 1 deletion tiktoken/model_to_encoding.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,12 @@
"gpt-4o-2024-05-13": "o200k_base",
"gpt-4o-2024-08-06":"o200k_base",
"gpt-4o-mini-2024-07-18": "o200k_base",
"gpt-4o-mini": "o200k_base"
"gpt-4o-mini": "o200k_base",
"o1-mini": "o200k_base",
"o1-preview": "o200k_base",
"o1-preview-2024-09-12": "o200k_base",
"o1-mini-2024-09-12": "o200k_base",
"chatgpt-4o-latest": "o200k_base",
"gpt-4o-realtime": "o200k_base",
"gpt-4o-realtime-preview-2024-10-01": "o200k_base"
}
14 changes: 14 additions & 0 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ export type TiktokenModel =
| "gpt-4o-2024-08-06"
| "gpt-4o-mini-2024-07-18"
| "gpt-4o-mini"
| "o1-mini"
| "o1-preview"
| "o1-preview-2024-09-12"
| "o1-mini-2024-09-12"
| "chatgpt-4o-latest"
| "gpt-4o-realtime"
| "gpt-4o-realtime-preview-2024-10-01"
/**
* @param {TiktokenModel} encoding
Expand Down Expand Up @@ -499,6 +506,13 @@ pub fn encoding_for_model(
"gpt-4o-2024-08-06" => Ok("o200k_base"),
"gpt-4o-mini-2024-07-18" => Ok("o200k_base"),
"gpt-4o-mini" => Ok("o200k_base"),
"o1-mini" => Ok("o200k_base"),
"o1-preview" => Ok("o200k_base"),
"o1-preview-2024-09-12" => Ok("o200k_base"),
"o1-mini-2024-09-12" => Ok("o200k_base"),
"chatgpt-4o-latest" => Ok("o200k_base"),
"gpt-4o-realtime" => Ok("o200k_base"),
"gpt-4o-realtime-preview-2024-10-01" => Ok("o200k_base"),
model => Err(JsError::new(
format!("Invalid model: {}", model.to_string()).as_str(),
)),
Expand Down

0 comments on commit 0ba7dbb

Please sign in to comment.