(fix) counting streaming prompt tokens - azure

This commit is contained in:
ishaan-jaff 2023-12-29 16:13:52 +05:30
parent d1049c8922
commit e6a7212d10
2 changed files with 2 additions and 2 deletions

View file

@ -164,8 +164,8 @@ def test_stream_chunk_builder_count_prompt_tokens():
non_stream_prompt_tokens = response.usage.prompt_tokens
non_stream_model = response.model
assert stream_model == non_stream_model
assert stream_prompt_tokens == non_stream_prompt_tokens
assert stream_model != non_stream_model
except Exception as e:
pytest.fail(f"An exception occurred - {str(e)}")

View file

@ -2505,7 +2505,7 @@ def token_counter(model="", text=None, messages: Optional[List] = None):
int: The number of tokens in the text.
"""
# use tiktoken, anthropic, cohere or llama2's tokenizer depending on the model
is_tool_call = True
is_tool_call = False
if text == None:
if messages is not None:
print_verbose(f"token_counter messages received: {messages}")