Calculate the number of language model tokens for a string
blog.mastykarz.nl
Calculate the number of language model tokens for a string
1–4 of 4 posts
Re: Calculate the number of language model tokens for a string
#2 import tiktoken
enc = tiktoken.encoding_for_model('o1-mini')
len(enc.encode('some string'))Re: Calculate the number of language model tokens for a string
#3import tiktoken enc = tiktoken.encoding_for_model('o1-mini') len(enc.encode('some string'))
Does that work on anything other than openai?