Route OpenAI o-series and gpt-3.5 model IDs to the OpenAI provider - #494
Open
rahul188 wants to merge 2 commits into
Open
Route OpenAI o-series and gpt-3.5 model IDs to the OpenAI provider#494rahul188 wants to merge 2 commits into
rahul188 wants to merge 2 commits into
Conversation
OPENAI_PATTERNS only enumerated the gpt-4 and gpt-5 families, so valid OpenAI model IDs from the reasoning line (o1, o3, o3-mini, o4-mini) and the legacy gpt-3.5-turbo family matched no provider and router.resolve raised InferenceConfigError. Add patterns for both families. The o-series pattern requires a digit after the o, so other o-prefixed IDs still fall through to the unregistered-model error. Fixes google#492
|
Your branch is 1 commits behind git fetch origin main
git merge origin/main
git pushNote: Enable "Allow edits by maintainers" to allow automatic updates. |
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.
Description
OPENAI_PATTERNSinlangextract/providers/patterns.pyonly enumerates thegpt-4*/gpt-5*families, so valid OpenAI model IDs from the reasoning line (o1,o3,o3-mini,o4-mini) and the legacygpt-3.5-turbofamily match no pattern androuter.resolveraisesInferenceConfigError, even thoughOpenAILanguageModelcan serve them.This adds two patterns:
^gpt-3\.5— the gpt-3.5-turbo family^o[1-9]— the o-series reasoning models; the required digit keeps other o-prefixed IDs (e.g.openchat) falling through to the unregistered-model error as before, and it does not collide with any built-in Ollama/Gemini patternThe new test resolves
o1,o3-mini,o4-mini,gpt-3.5-turbo(andgpt-4oas a guard against regressions) toOpenAILanguageModel, and assertsopenchatstill raisesInferenceConfigErrorso the o-series pattern can't over-match.Fixes #492
Bug fix
How Has This Been Tested?
The new test was run against unmodified
mainfirst and fails there on exactly the four uncovered model IDs (SUBFAILEDforo1,o3-mini,o4-mini,gpt-3.5-turbo;gpt-4opasses), and passes with the fix.pyink,isort, andpylintare clean on the changed files.Checklist:
Code of conduct.
Contributing
page, and I either signed the Google
Individual CLA
or am covered by my company's
Corporate CLA.
issue(s) and we have agreed upon the general approach. (The change follows
the fix suggested in Bug: OpenAI o-series (o1/o3/o4-mini) and gpt-3.5 model IDs route to no provider #492; happy to adjust if the owners prefer a different
pattern set.)
issue(s) that documentation elsewhere needs updating.
Google's Python Style Guide
and ran
pylintover the affected code.