cellmage.utils.token_utilsยถ
Token counting utilities for estimating token usage in LLM prompts.
This module provides functions for accurately counting tokens using tiktoken or falling back to heuristic methods when tiktoken is not available.
Functions
|
Count tokens in text using the default token counter. |
|
Count tokens in a list of messages, with role-based categorization. |
|
Count tokens in code using the default token counter. |
|
Count tokens in a dictionary using the default token counter. |
|
Count tokens in a list using the default token counter. |
Classes
|
A configurable token counting utility for accurate token estimation. |