Skip to content

Support o3/o4 models #110

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

zurawiki
Copy link
Owner

Summary

  • support o3 and o4 model prefixes for tokenizer lookup
  • document o-series models in README
  • document that o200k_base works with o1/o3/o4 models
  • expose context size for o3/o4 models
  • add tests covering new o-series handling

Testing

  • cargo test (fails: failed to download crates)

@@ -36,7 +36,7 @@ pub fn get_context_size(model: &str) -> usize {
let base = rest.split(':').next().unwrap_or(rest);
return get_context_size(base);
}
if starts_with_any!(model, "o1-") {
if starts_with_any!(model, "o1-", "o3-", "o4-") {

Choose a reason for hiding this comment

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

We should probably remove the - so that it includes the parent model and not just the -mini version of the model. The reasoning models also have a context window of 200,000 not 128,000 like the older 4o type model. We should probably also add gpt-4.1 which has a context window of 1,047,576.

    if starts_with_any!(model, "o1", "o3", "o4") {
        return 200_000;
    }
    if starts_with_any!(model, "gpt-4.1") {
        return 1_047_576;
    }

@@ -105,7 +105,7 @@ println!("max_tokens: {}", max_tokens);

| Encoding name | OpenAI models |
| ----------------------- | ------------------------------------------------------------------------- |
| `o200k_base` | GPT-4o models, o1 models |
| `o200k_base` | GPT-4o models, o1, o3, and o4 models |

Choose a reason for hiding this comment

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

We should add 4.1 as well

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.

2 participants