Skip to content
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

Token count #4

Open
tmokmss opened this issue Oct 9, 2023 · 1 comment
Open

Token count #4

tmokmss opened this issue Oct 9, 2023 · 1 comment

Comments

@tmokmss
Copy link
Owner

tmokmss commented Oct 9, 2023

Currently we're using tiktoken to calculate token count (not changed from original implementation.) It seems it's already providing a good estimation but ideally we should use this. https://github.com/anthropics/anthropic-tokenizer-typescript

@tmokmss
Copy link
Owner Author

tmokmss commented Apr 5, 2024

Note that the above library is no longer exactly accurate on Claude 3.

This package can be used to count tokens for Anthropic's older models. As of the Claude 3 models, this algorithm is no longer accurate, but can be used as a very rough approximation. We suggest that you rely on usage in the response body wherever possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant