Source code for agentscope.token._token_base

# -*- coding: utf-8 -*-
"""The token base class in agentscope."""
from abc import abstractmethod
from typing import Any


[docs] class TokenCounterBase: """The base class for token counting."""
[docs] @abstractmethod async def count( self, messages: list[dict], **kwargs: Any, ) -> int: """Count the number of tokens by the given model and messages."""