Spaces:
No application file
No application file
| import tiktoken | |
| def count_num_tokens(text: str, model: str) -> int: | |
| encoding = tiktoken.encoding_for_model(model) | |
| return len(encoding.encode(text)) |
| import tiktoken | |
| def count_num_tokens(text: str, model: str) -> int: | |
| encoding = tiktoken.encoding_for_model(model) | |
| return len(encoding.encode(text)) |