(self, model_name: str)
| 5 | |
| 6 | class Tokenizer(object): |
| 7 | def __init__(self, model_name: str) -> None: |
| 8 | if model_name in ["gpt-4", "gpt-turbo-3.5"]: |
| 9 | self.tokenizer = tiktoken.encoding_for_model(model_name) |
| 10 | else: |
| 11 | raise NotImplementedError |
| 12 | |
| 13 | def __call__(self, text: str) -> list[int]: |
| 14 | return self.tokenizer.encode(text) |
nothing calls this directly
no outgoing calls
no test coverage detected