mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Merge 6e6849f416
into b82af5b826
This commit is contained in:
commit
fd83817fb8
1 changed files with 1 additions and 4 deletions
|
@ -1627,10 +1627,7 @@ def openai_token_counter( # noqa: PLR0915
|
|||
"""
|
||||
print_verbose(f"LiteLLM: Utils - Counting tokens for OpenAI model={model}")
|
||||
try:
|
||||
if "gpt-4o" in model:
|
||||
encoding = tiktoken.get_encoding("o200k_base")
|
||||
else:
|
||||
encoding = tiktoken.encoding_for_model(model)
|
||||
encoding = tiktoken.encoding_for_model(model)
|
||||
except KeyError:
|
||||
print_verbose("Warning: model not found. Using cl100k_base encoding.")
|
||||
encoding = tiktoken.get_encoding("cl100k_base")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue