Skip to content

Fix: Matching built-in providers fails if specified by name (Fixes #335)#351

Open
ambicuity wants to merge 3 commits intogoogle:mainfrom
ambicuity:fix/issue-335-provider-loading
Open

Fix: Matching built-in providers fails if specified by name (Fixes #335)#351
ambicuity wants to merge 3 commits intogoogle:mainfrom
ambicuity:fix/issue-335-provider-loading

Conversation

@ambicuity
Copy link
Copy Markdown

Description

This PR fixes Issue #335 where specifying a built-in provider by name (e.g., provider="google") would fail in configurations using schema constraints. This happened because _create_model_with_schema was attempting to resolve the provider before ensuring that built-in providers were loaded into the registry.

The fix ensures that providers.load_builtins_once() is called unconditionally at the start of _create_model_with_schema.

Fixes #335

Bug fix

How Has This Been Tested?

I verified the fix with a reproduction script that attempted to create a model with provider="gemini" and schema constraints.
Before the fix, this resulted in an InferenceConfigError.
After the fix, the provider is successfully resolved.

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.

@github-actions github-actions bot added the size/XS Pull request with less than 50 lines changed label Feb 10, 2026
@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.

3 similar comments
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 5, 2026

⚠️ 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.

@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.

@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.

@github-actions
Copy link
Copy Markdown

⚠️ Branch Update Required

Your branch is 7 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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

⚠️ Branch Update Required

Your branch is 8 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/XS Pull request with less than 50 lines changed

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