API Reference
token_count_utils
token_left
Count number of tokens left for an OpenAI model.
Arguments:
input
- (str, list, dict): Input to the model.model
- (str): Model name.
Returns:
int
- Number of tokens left that the model can use for completion.
count_token
Count number of tokens used by an OpenAI model.
Arguments:
input
- (str, list, dict): Input to the model.model
- (str): Model name.
Returns:
int
- Number of tokens from the input.
num_tokens_from_functions
Return the number of tokens used by a list of functions.
Arguments:
functions
- (list): List of function descriptions that will be passed in model.model
- (str): Model name.
Returns:
int
- Number of tokens from the function descriptions.