mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-11 18:35:18 +00:00
Fix tokenizer fallback to use o200k_base instead of cl100k_base
This commit is contained in:
parent
4b58a5488f
commit
08bf9593b2
1 changed files with 5 additions and 2 deletions
|
|
@ -19,8 +19,11 @@ class TokenEncoder:
|
|||
with cls._lock: # Lock acquisition to ensure thread safety
|
||||
if cls._encoder_instance is None or model != cls._model:
|
||||
cls._model = model
|
||||
cls._encoder_instance = encoding_for_model(cls._model) if "gpt" in cls._model else get_encoding(
|
||||
"cl100k_base")
|
||||
try:
|
||||
cls._encoder_instance = encoding_for_model(cls._model) if "gpt" in cls._model else get_encoding(
|
||||
"o200k_base")
|
||||
except:
|
||||
cls._encoder_instance = get_encoding("o200k_base")
|
||||
return cls._encoder_instance
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue