MCPcopy
hub / github.com/VectifyAI/PageIndex / count_tokens

Function count_tokens

pageindex/utils.py:26–29  ·  view source on GitHub ↗
(text, model=None)

Source from the content-addressed store, hash-verified

24litellm.drop_params = True
25
26def count_tokens(text, model=None):
27 if not text:
28 return 0
29 return litellm.token_counter(model=model, text=text)
30
31
32def llm_completion(model, prompt, chat_history=None, return_finish_reason=False):

Callers 6

process_no_tocFunction · 0.85
check_token_limitFunction · 0.85
get_node_summaryFunction · 0.85
tree_thinning_for_indexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected