Skip to content

Fix abstract schemas generated by provider plugin script - #504

Open
fallintoplace wants to merge 1 commit into
google:mainfrom
fallintoplace:fix/generated-schema-abstract
Open

Fix abstract schemas generated by provider plugin script#504
fallintoplace wants to merge 1 commit into
google:mainfrom
fallintoplace:fix/generated-schema-abstract

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 25, 2026

Copy link
Copy Markdown

Description

Fixes #505
Related to #99

Type: Bug fix

Summary

The provider plugin generator added in #144 still emits the old
supports_strict_mode property. When BaseSchema moved to the
requires_raw_output contract in #239, the generator template was not updated.
As a result, schemas created with --with-schema remain abstract and
from_examples() raises a TypeError.

This change:

  • replaces the stale property with the required requires_raw_output
    implementation
  • returns True because the generated provider configures structured output as
    raw JSON
  • adds a regression test that generates and imports the schema, then
    instantiates it through from_examples()

The patch is limited to the generator template and its provider-plugin
regression coverage. It restores the documented workflow without changing
runtime APIs.

How Has This Been Tested?

pytest -q -m "not live_api and not requires_pip and not integration"
pyink scripts/create_provider_plugin.py tests/provider_plugin_test.py --check --diff --config pyproject.toml
isort scripts/create_provider_plugin.py tests/provider_plugin_test.py --check-only --diff
pylint --rcfile=tests/.pylintrc tests/provider_plugin_test.py

The local suite passed with 707 tests and 47 subtests. CI also passes
formatting, Python 3.10 through 3.12, and the plugin and Ollama integration
suites.

Checklist:

  • I have read and acknowledged Google's Open Source Code of conduct.
  • I have read the Contributing page and am covered by the CLA check.
  • I have discussed the fix with code owners in the linked issue.
  • No documentation change is needed because the provider guide already documents requires_raw_output.
  • I added a regression test that exercises the generated schema.
  • I followed Google's Python style guidance and ran pylint over the affected test file.

@github-actions

Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the size/XS Pull request with less than 50 lines changed label Jul 25, 2026
@fallintoplace fallintoplace changed the title Fix generated provider schemas remaining abstract Fix abstract schemas generated by provider plugin script Jul 25, 2026
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.

Generated provider schema cannot be instantiated with --with-schema

1 participant