From 1170ed6566907f1668356832248413247ed375f3 Mon Sep 17 00:00:00 2001 From: 6vision Date: Mon, 14 Oct 2024 12:17:10 +0800 Subject: [PATCH] Optimize Gemini model character statistics --- bot/chatgpt/chat_gpt_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/chatgpt/chat_gpt_session.py b/bot/chatgpt/chat_gpt_session.py index aa34ba316..7adaa3e41 100644 --- a/bot/chatgpt/chat_gpt_session.py +++ b/bot/chatgpt/chat_gpt_session.py @@ -57,7 +57,7 @@ def calc_tokens(self): def num_tokens_from_messages(messages, model): """Returns the number of tokens used by a list of messages.""" - if model in ["wenxin", "xunfei", const.GEMINI]: + if model in ["wenxin", "xunfei"] or model.startswith(const.GEMINI): return num_tokens_by_character(messages) import tiktoken