From a899c33cff5e3bb25d91c4cb5cdb86cd11e30133 Mon Sep 17 00:00:00 2001 From: Delfer Date: Thu, 4 Jul 2024 17:08:35 +0000 Subject: [PATCH] Fixed unknown encoding error --- bot/openai_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/openai_helper.py b/bot/openai_helper.py index 5a1896cf..f0777bf3 100644 --- a/bot/openai_helper.py +++ b/bot/openai_helper.py @@ -653,7 +653,7 @@ def __count_tokens(self, messages) -> int: try: encoding = tiktoken.encoding_for_model(model) except KeyError: - encoding = tiktoken.get_encoding("gpt-3.5-turbo") + encoding = tiktoken.get_encoding("cl100k_base") if model in GPT_3_MODELS + GPT_3_16K_MODELS: tokens_per_message = 4 # every message follows <|start|>{role/name}\n{content}<|end|>\n