Skip to content

Commit

Permalink
update type hint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZingLix authored and danielhjz committed Nov 9, 2023
1 parent 8936898 commit f75a2c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/qianfan/resources/tools/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

import unicodedata
from typing import Any
from typing import Any, Literal

from qianfan import get_config
from qianfan.consts import Consts
Expand All @@ -33,7 +33,11 @@ class Tokenizer(object):

@classmethod
def count_tokens(
cls, text: str, mode: str = "local", model: str = "ERNIE-Bot", **kwargs: Any
cls,
text: str,
mode: Literal["local", "remote"] = "local",
model: str = "ERNIE-Bot",
**kwargs: Any,
) -> int:
"""
Count the number of tokens in a given text.
Expand Down

0 comments on commit f75a2c0

Please sign in to comment.