Skip to content

fix: Error matching built-in providers if specified by name rather than inferred from model.#331

Open
telackey wants to merge 4 commits intogoogle:mainfrom
SolidCore-ai:telackey/loadonce
Open

fix: Error matching built-in providers if specified by name rather than inferred from model.#331
telackey wants to merge 4 commits intogoogle:mainfrom
SolidCore-ai:telackey/loadonce

Conversation

@telackey
Copy link

@telackey telackey commented Jan 27, 2026

Fixes #335

Description

This fixes an error where specifying a built-in provider by name when using ModelConfig would fail, because router.resolve_provider(config.provider) without first calling providers.load_builtins_once(), which was only called when the provider was being inferred.

The actual fix here is tiny, which is to lift the load_builtins_once/load_plugins_once calls outside the if/then. Since the loading is done only once, the impact should be insignificant.

Before:

langextract.core.exceptions.InferenceConfigError:
    No provider found matching: 'ollama'. Available providers can be listed with list_providers()

How Has This Been Tested?

Manually and new unit test added.

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 made any needed documentation changes, or noted in the linked issue(s) that documentation elsewhere needs updating. (N/A)
  • 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.

@google-cla
Copy link

google-cla bot commented Jan 27, 2026

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.

@telackey telackey marked this pull request as ready for review January 28, 2026 19:15
@github-actions
Copy link

No linked issues found. Please link an issue in your pull request description or title.

Per our Contributing Guidelines, all PRs must:

  • Reference an issue with one of:
    • Closing keywords: Fixes #123, Closes #123, Resolves #123 (auto-closes on merge in the same repository)
    • Reference keywords: Related to #123, Refs #123, Part of #123, See #123 (links without closing)
  • The linked issue should have 5+ 👍 reactions from unique users (excluding bots and the PR author)
  • Include discussion demonstrating the importance of the change

You can also use cross-repo references like owner/repo#123 or full URLs.

@telackey telackey changed the title fix: Locate built-in providers if identified by name rather than inferred by model. fix: Error matching built-in providers if specified by name rather than inferred from model. Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Matching built-in providers fails if specified by name rather than inferred from model.

1 participant