forked from phoenix/litellm-mirror
fix(utils.py): don't add chatml tokens to a simple text token count
This commit is contained in:
parent
75614bc29c
commit
5d428ac94c
1 changed files with 2 additions and 0 deletions
|
@ -3597,6 +3597,8 @@ def token_counter(
|
|||
raise ValueError("text and messages cannot both be None")
|
||||
elif isinstance(text, List):
|
||||
text = "".join(t for t in text if isinstance(t, str))
|
||||
elif isinstance(text, str):
|
||||
count_response_tokens = True # user just trying to count tokens for a text. don't add the chat_ml +3 tokens to this
|
||||
|
||||
if model is not None:
|
||||
tokenizer_json = _select_tokenizer(model=model)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue