Skip to content

Fix common.ai Vertex model example to use a valid pydantic-ai prefix - #72011

Open
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:fix-common-ai-vertex-prefix
Open

Fix common.ai Vertex model example to use a valid pydantic-ai prefix#72011
Lee-W wants to merge 1 commit into
apache:mainfrom
astronomer:fix-common-ai-vertex-prefix

Conversation

@Lee-W

@Lee-W Lee-W commented Aug 23, 2026

Copy link
Copy Markdown
Member

The documented model-identifier example for the Google Vertex AI connection ("google-vertex:gemini-2.0-flash") is not a provider prefix pydantic-ai recognizes; calling infer_provider_class with it raises ValueError: Unknown provider. Users who copy the connection form placeholder, docstring example, or hook default verbatim hit an immediate, confusing failure instead of an expected credentials error.

pydantic-ai renamed this provider id to "google-cloud:" when it split GoogleProvider(vertexai=True) into separate GoogleProvider and GoogleCloudProvider classes (pydantic/pydantic-ai#5336), shortly before these examples were written. Update the connection-form placeholder, hook docstrings, and tests to the working prefix, and add a regression test that exercises the real (unmocked) provider resolution so the example string can't silently drift again.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [Tool Name] following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

The documented model-identifier example for the Google Vertex AI
connection ("google-vertex:gemini-2.0-flash") is not a provider
prefix pydantic-ai recognizes; calling infer_provider_class with it
raises ValueError: Unknown provider. Users who copy the connection
form placeholder, docstring example, or hook default verbatim hit an
immediate, confusing failure instead of an expected credentials error.

pydantic-ai renamed this provider id to "google-cloud:" when it split
GoogleProvider(vertexai=True) into separate GoogleProvider and
GoogleCloudProvider classes (pydantic/pydantic-ai#5336), shortly
before these examples were written. Update the connection-form
placeholder, hook docstrings, and tests to the working prefix, and add
a regression test that exercises the real (unmocked) provider
resolution so the example string can't silently drift again.

@ColtenOuO ColtenOuO left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall!

One stale prefix left over from the same rename -- commented inline.

We could fix the merge conflict along the way ><

result = hook._get_provider_kwargs(
None,
None,
{"model": "google-gla:gemini-2.0-flash", "api_key": "gla-key"},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the same pydantic-ai release, the google-gla prefix was renamed to google. Might be worth updating this one too while you're at it.

That said, it doesn't affect the test's behavior.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants