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

chore: setup o200k_base tokenizer #43

Merged
merged 6 commits into from
Jul 17, 2024

Conversation

mbukeRepo
Copy link
Contributor

@mbukeRepo mbukeRepo commented May 15, 2024

This PR integrates the new tokenizer for gpt-4o o200k_base.

Encoding file:
https://openaipublic.blob.core.windows.net/encodings/o200k_base.tiktoken 214

Closes #42

@mbukeRepo mbukeRepo marked this pull request as ready for review May 16, 2024 21:28
Copy link

@caugner caugner May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might also want to update lines 5, 14, and 48-51:

`gpt-tokenizer` is a highly optimized Token Byte Pair Encoder/Decoder for all OpenAI's models (including those used by GPT-2, GPT-3, GPT-3.5 and GPT-4). It's written in TypeScript, and is fully compatible with all modern JavaScript environments.

- Support for all current OpenAI models (available encodings: `r50k_base`, `p50k_base`, `p50k_edit` and `cl100k_base`)

gpt-tokenizer/README.md

Lines 48 to 51 in 44ce38e

- https://unpkg.com/gpt-tokenizer/dist/cl100k_base.js
- https://unpkg.com/gpt-tokenizer/dist/p50k_base.js
- https://unpkg.com/gpt-tokenizer/dist/p50k_edit.js
- https://unpkg.com/gpt-tokenizer/dist/r50k_base.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Claas, I applied the requested changes.

@mccabejj
Copy link

mccabejj commented Jul 1, 2024

Any idea when this will merge?

@prateekkathal
Copy link

@niieani @caugner Sry I am bumping this by tagging you.

We're trying to move to GPT-4o but the token calculations are coming out to be wrong since the base is different for GPT-4 Turbo & GPT-4o. It is imperative we have this PR merged as we are using this package in production. Until this PR gets merged, we are blocked.

Copy link
Owner

@niieani niieani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@niieani niieani merged commit 5da006e into niieani:main Jul 17, 2024
@prateekkathal
Copy link

@niieani Thanks for merging. Seems like there is a formatting issue with the code blocking it from being published to NPM?

Possible to check on your end and make these fixes?

Copy link

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

Support New o200k_base
5 participants