-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use tiktoken.el for token counting of openai's models #14
Comments
Very interesting, thanks for sharing this! Before we go further, do you have FSF copyright assignment already, or if not, are you willing to get it? Since this is part of GNU ELPA, all contributions must be from those who have assigned copyright to the FSF. |
Yeah! I have the FSF copyright paperwork in so I should be good there. |
Great, in that case to use your encoder, we could either put your library in ELPA (you would do this via emacs-devel@ mailing list), which I can then depend on, or include your encoder in the llm library directly. What's the difference in accuracy, do you think? Is it worth it to include this code? And as far as embedding vs chat, from what I understand, they use the same encoder, |
Great analysis, thank you so much for that! Let's keep this issue open - it might become critical in the future, but first I need to do other things before I think we'd need this, namely:
Let's see where things take us. Thanks again for developing this library and reaching out about it. |
Sounds good! I agree that those would be best to tackle first. |
Hello!
I noticed that one of the methods for the providers is
llm-count-tokens
which currently does a simple heuristic. I recently wrote a port of tiktoken that could add this functionality for at least the OpenAI models. The implementation in llm-openai.el would essentially look like the following:There would be some design questions like should it use the chat-model or the embedding-model when doing this. Like maybe it would first try to count with the embedding-model if it exists, otherwise the chat-model, with some default.
Definitely let me know your thoughts and I could have a PR up for it along with any other required work.
The text was updated successfully, but these errors were encountered: