File tree Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Expand file tree Collapse file tree 4 files changed +22
-3
lines changed Original file line number Diff line number Diff line change 216
216
ssl_verify : Union [str , bool ] = True
217
217
ssl_certificate : Optional [str ] = None
218
218
disable_streaming_logging : bool = False
219
+ disable_token_counter : bool = False
219
220
disable_add_transform_inline_image_block : bool = False
220
221
in_memory_llm_clients_cache : LLMClientCache = LLMClientCache ()
221
222
safe_memory_mode : bool = False
Original file line number Diff line number Diff line change @@ -362,6 +362,15 @@ def token_counter(
362
362
"""
363
363
from litellm .utils import convert_list_message_to_dict
364
364
365
+ #########################################################
366
+ # Flag to disable token counter
367
+ # We've gotten reports of this consuming CPU cycles,
368
+ # exposing this flag to allow users to disable
369
+ # it to confirm if this is indeed the issue
370
+ #########################################################
371
+ if litellm .disable_token_counter is True :
372
+ return 0
373
+
365
374
verbose_logger .debug (
366
375
f"messages in token_counter: { messages } , text in token_counter: { text } "
367
376
)
Original file line number Diff line number Diff line change @@ -4,6 +4,5 @@ model_list:
4
4
model : openai/*
5
5
6
6
7
-
8
-
9
-
7
+ litellm_settings :
8
+ disable_token_counter : True
Original file line number Diff line number Diff line change @@ -1697,6 +1697,16 @@ def token_counter(
1697
1697
1698
1698
Kept for backwards compatibility.
1699
1699
"""
1700
+
1701
+ #########################################################
1702
+ # Flag to disable token counter
1703
+ # We've gotten reports of this consuming CPU cycles,
1704
+ # exposing this flag to allow users to disable
1705
+ # it to confirm if this is indeed the issue
1706
+ #########################################################
1707
+ if litellm .disable_token_counter is True :
1708
+ return 0
1709
+
1700
1710
return token_counter_new (
1701
1711
model ,
1702
1712
custom_tokenizer ,
You can’t perform that action at this time.
0 commit comments