2 ms·
>> tiktoken.encoding_for_model(model) > Calling this where model == 'gpt-4o' will encode with CL200k no? No, it will never use O200K, I don't know how to word
by refulgentis 2y ago
>> tiktoken.encoding_for_model(model)
> Calling this where model == 'gpt-4o' will encode with CL200k no?
No, it will never use O200K, I don't know how to word where its located without sounding aggro, apologies: read below, i.e. the rest of the method.
They copied demo code for Tiktoken with an allowlist without gpt-4o in it, because the demo code is from before 4o.
The demo code has an allowlist, that does string matching, and if its not one of 5 models, none of which are gpt-4o, it says "eh, if it starts gpt-4, just use gpt-4-0613, and make a recursive call"
You can't really blame them, because all they did was copy demo code from OpenAI from before gpt-4o, but I hope you get a giggle out of the extreme clown car this situation is. It's a really bad paper-thin out-of-date tiktoken wrapper that can only do c100k and claims support for 400 LLMs.
Really bonkers.
I know you gotta read the whole method to get it, but, people really shouldn't have just been like "my word! its mean to say they don't get it!" -- it's horrible.
https://github.com/AgentOps-AI/tokencost/blob/e1d52dbaa3ada232aa68dabf5b58662da4bc2363/tokencost/costs.py#L46\\\\\\ https://github.com/AgentOps-AI/tokencost/blob/e1d52dbaa3ada2...