token_count_utils
token_left
def token_left(input: Union[str, List, Dict],
model="gpt-3.5-turbo-0613") -> int
计算 OpenAI 模型剩余的标记数。
参数:
input
- (str, list, dict): 输入给模型的内容。model
- (str): 模型名称。
返回值:
int
- 模型可以用于完成的剩余标记数。
count_token
def count_token(input: Union[str, List, Dict],
model: str = "gpt-3.5-turbo-0613") -> int
计算 OpenAI 模型使用的标记数。
参数:
input
- (str, list, dict): 输入给模型的内容。model
- (str): 模型名称。
返回值:
int
- 输入内容的标记数。
num_tokens_from_functions
def num_tokens_from_functions(functions, model="gpt-3.5-turbo-0613") -> int
计算一组函数描述使用的标记数。
参数:
functions
- (list): 将传递给模型的函数描述列表。model
- (str): 模型名称。
返回值:
int
- 函数描述的标记数。