Route modern OpenAI models through chat completions#1651
Open
kayametehan wants to merge 1 commit intoopenai:mainfrom
Open
Route modern OpenAI models through chat completions#1651kayametehan wants to merge 1 commit intoopenai:mainfrom
kayametehan wants to merge 1 commit intoopenai:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates model routing so modern OpenAI chat/reasoning model families (e.g., gpt-4o*, gpt-4.1*, gpt-4.5*, o1*, o3*, o4*) are correctly identified as chat models and sent through the chat-completions path, preventing v1/completions endpoint errors.
Changes:
- Expand
is_chat_model()to recognize additional modern model prefixes (gpt-4o,gpt-4.1,gpt-4.5,o1,o3,o4). - Add regression tests covering new chat-model detection cases.
- Add a routing regression test ensuring
Registry.make_completion_fn()returns anOpenAIChatCompletionFnforgpt-4o-mini.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| evals/registry.py | Extends chat-model detection to include modern OpenAI model families so routing uses chat completions. |
| evals/registry_test.py | Adds regression tests for new model-family detection and Registry.make_completion_fn() routing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1580.
Overview
oaievalcurrently routes modern OpenAI chat/reasoning models likegpt-4o-minithrough the non-chat completions path becauseis_chat_model()only recognizes older model families.That causes requests such as:
oaieval gpt-4o-mini ...to fail with the completions endpoint error:
This is a chat model and not supported in the v1/completions endpointWhat changed
is_chat_model()to recognize modern OpenAI chat/reasoning model familiesgpt-4o*,gpt-4.1*,gpt-4.5*,o1*,o3*, ando4*Registry.make_completion_fn()routingValidation
I verified this change with focused checks before pushing:
python -m pytest evals/registry_test.py -qRegistry.make_completion_fn()checks forgpt-4o-mini,gpt-4.1-mini,o1-mini,o3-mini,o4-miniOpenAISolverchecks forgpt-4o-miniando3-minigit diff --check