count_token

count_token(input: str | list | dict, model: str = 'gpt-3.5-turbo-0613') -> int

Count number of tokens used by an OpenAI model.

Parameters:
NameDescription
input(str, list, dict): Input to the model.

Type: str | list | dict
model(str): Model name.

Type: str

Default: ‘gpt-3.5-turbo-0613’
Returns:
TypeDescription
intint: Number of tokens from the input.