From 2485a04d63712864b2b62298f1c6b74909f9089f Mon Sep 17 00:00:00 2001 From: ColemanDunn <42652642+ColemanDunn@users.noreply.github.com> Date: Thu, 17 Apr 2025 10:54:41 -0600 Subject: [PATCH] Fix: Add o4- and o4 to MODEL_PREFIX_TO_ENCODING (main) Adds support for the `o4-` and `o4` prefixes to the `MODEL_PREFIX_TO_ENCODING` dictionary. These prefixes are now correctly mapped to `o200k_base`. --- tiktoken/model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tiktoken/model.py b/tiktoken/model.py index 4298ae7..278bf25 100644 --- a/tiktoken/model.py +++ b/tiktoken/model.py @@ -7,6 +7,7 @@ MODEL_PREFIX_TO_ENCODING: dict[str, str] = { "o1-": "o200k_base", "o3-": "o200k_base", + "o4-": "o200k_base", # chat "chatgpt-4o-": "o200k_base", "gpt-4o-": "o200k_base", # e.g., gpt-4o-2024-05-13 @@ -25,6 +26,7 @@ # reasoning "o1": "o200k_base", "o3": "o200k_base", + "o4": "o200k_base", # chat "gpt-4o": "o200k_base", "gpt-4": "cl100k_base",