Skip to content

Fix: OpenAI o-series and gpt-3.5 model IDs route to no provider - #510

Open
Karthick-dev-cart wants to merge 2 commits into
google:mainfrom
Karthick-dev-cart:bugfix/492-openai-o-series-gpt35-routing
Open

Fix: OpenAI o-series and gpt-3.5 model IDs route to no provider#510
Karthick-dev-cart wants to merge 2 commits into
google:mainfrom
Karthick-dev-cart:bugfix/492-openai-o-series-gpt35-routing

Conversation

@Karthick-dev-cart

@Karthick-dev-cart Karthick-dev-cart commented Aug 3, 2026

Copy link
Copy Markdown

Description

Fixes #492

Bug fix

OPENAI_PATTERNS in langextract/providers/patterns.py only matched gpt-4/gpt4./gpt-5/gpt5. prefixes. Any OpenAI o-series reasoning model id (o1, o3, o3-mini, o4-mini, ...) or a legacy gpt-3.5-turbo-style id matched no provider pattern at all, so factory.create_model() raised InferenceConfigError: no provider found instead of routing to the OpenAI provider. Adds the two missing patterns (^gpt-3\.5, ^o[1-9]).

How Has This Been Tested?

Added tests/patterns_test.py with two tests:

  • test_reasoning_and_legacy_openai_models_resolve_to_openai_provider -- verifies o-series (o1, o1-mini, o3, o3-mini, o4-mini) and gpt-3.5-turbo all resolve to the OpenAI provider via the router, as subtests.
  • test_ollama_gpt_oss_pattern_is_unaffected -- guards against the new o[1-9] pattern accidentally shadowing Ollama's existing gpt-oss model support.
$ python -m pytest tests/
61 passed, 3 skipped (pre-existing, unrelated -- missing API keys / no local Ollama)

Checklist:

  • I have read and acknowledged Google's Open Source Code of conduct.
  • I have read the Contributing page, and I either signed the Google Individual CLA or am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have made any needed documentation changes, or noted in the linked issue(s) that documentation elsewhere needs updating.
  • I have added tests, or I have ensured existing tests cover the changes
  • I have followed Google's Python Style Guide and ran pylint over the affected code.

Fixes google#492

OPENAI_PATTERNS only matched gpt-4/gpt-5 prefixes, so any o-series
reasoning model (o1, o3, o4-mini, ...) or a legacy gpt-3.5 model id
raised InferenceConfigError instead of routing to the OpenAI provider.
Adds the two missing patterns and a regression test.
@github-actions github-actions Bot added the size/S Pull request with 50-150 lines changed label Aug 3, 2026
@google-cla

google-cla Bot commented Aug 3, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Karthick-dev-cart

Copy link
Copy Markdown
Author

@googlebot I signed it!

@github-actions

Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 1 commits behind main. Please update your branch to ensure CI checks run with the latest code:

git fetch origin main
git merge origin/main
git push

Note: Enable "Allow edits by maintainers" to allow automatic updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Pull request with 50-150 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: OpenAI o-series (o1/o3/o4-mini) and gpt-3.5 model IDs route to no provider

1 participant