agentscope.utils.token_utils module

Token utils.

count_openai_token(content: str | list, model: str) int[source]

Count token in format of OpenAI API

get_openai_max_length(model_name: str) int[source]

Get the max length of the OpenAi models.

num_tokens_from_content(content: list, model: str) int[source]

Count token in format of OpenAI Chat API