From 17a102d053b8404ee079b853e048af09e1dade90 Mon Sep 17 00:00:00 2001 From: Jinhua Wang Date: Tue, 30 Apr 2024 21:42:38 +0100 Subject: [PATCH] Update token_count_utils.py (#2531) * Update token_count_utils.py Update the token counts of new gpt models ref: https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4 * format code with pre-commit --------- Co-authored-by: Chi Wang Co-authored-by: Eric Zhu --- autogen/token_count_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autogen/token_count_utils.py b/autogen/token_count_utils.py index d68e4ee81528..589d7b404a7d 100644 --- a/autogen/token_count_utils.py +++ b/autogen/token_count_utils.py @@ -14,7 +14,8 @@ def get_max_token_limit(model: str = "gpt-3.5-turbo-0613") -> int: model = re.sub(r"^gpt4", "gpt-4", model) max_token_limit = { - "gpt-3.5-turbo": 4096, + "gpt-3.5-turbo": 16385, + "gpt-3.5-turbo-0125": 16385, "gpt-3.5-turbo-0301": 4096, "gpt-3.5-turbo-0613": 4096, "gpt-3.5-turbo-instruct": 4096, @@ -22,6 +23,8 @@ def get_max_token_limit(model: str = "gpt-3.5-turbo-0613") -> int: "gpt-3.5-turbo-16k-0613": 16385, "gpt-3.5-turbo-1106": 16385, "gpt-4": 8192, + "gpt-4-turbo": 128000, + "gpt-4-turbo-2024-04-09": 128000, "gpt-4-32k": 32768, "gpt-4-32k-0314": 32768, # deprecate in Sep "gpt-4-0314": 8192, # deprecate in Sep