langchain_community.callbacks.infino_callback
.get_num_tokens¶
- langchain_community.callbacks.infino_callback.get_num_tokens(string: str, openai_model_name: str) int [source]¶
Calculate num tokens for OpenAI with tiktoken package.
- Official documentation: https://github.com/openai/openai-cookbook/blob/main
/examples/How_to_count_tokens_with_tiktoken.ipynb