-
Notifications
You must be signed in to change notification settings - Fork 17.9k
[OpenAI]: Encoding Model #31402
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
[OpenAI]: Encoding Model #31402
Conversation
keenborder786
commented
May 28, 2025
- Description: Small Fix for when getting the encoder in case of KeyError and using the correct encoder for newer models
- Issue: self._get_encoding_model of langchain_openai.BaseChatOpenAI class returns incorrect string #31390
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
model = "cl100k_base" | ||
encoding = tiktoken.get_encoding(model) | ||
encoder = "cl100k_base" | ||
if self.model_name.startswith("gpt-4o"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be gpt-4.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4.1 models use the o200k_base
encoding
https://huggingface.co/datasets/openai/mrcr#how-to-run
https://community.openai.com/t/whats-the-tokenization-algorithm-gpt-4-1-uses/1245758
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay thanks, will update
CodSpeed Walltime Performance ReportMerging #31402 will not alter performanceComparing
|
CodSpeed Instrumentation Performance ReportMerging #31402 will not alter performanceComparing Summary
|
@ccurme can you please check? |
@ccurme this is good to go |
@ccurme , please review and let me know if there is an issue |