Skip to content

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

Merged
Lee-W merged 1 commit into
apache:mainfrom
astronomer:fix-common-ai-vertex-prefix
Aug 27, 2026
Merged

Lee-W merged 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.

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

@Lee-W
Lee-W force-pushed the fix-common-ai-vertex-prefix branch 2 times, most recently from 9303aef to 293f573 Compare August 27, 2026 11:44
…test

The Vertex hook's tests still built their connection extras from
"google-vertex:gemini-2.0-flash", a provider id pydantic-ai no longer
recognizes -- it was renamed to "google-cloud:" when GoogleProvider(vertexai=True)
was split into GoogleProvider and GoogleCloudProvider
(pydantic/pydantic-ai#5336). The user-facing strings were corrected in apache#72012,
but the fixtures kept exercising a prefix that raises "Unknown provider" in
real use, so nothing in the suite would notice the documented example drifting
away from a working one again.

Align the fixtures with the prefix the hook now documents and add a test that
resolves it through pydantic-ai's own provider lookup rather than a mock.
@Lee-W
Lee-W force-pushed the fix-common-ai-vertex-prefix branch from 293f573 to 122b32b Compare August 27, 2026 14:34

@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:D

@Lee-W
Lee-W merged commit 3d4216a into apache:main Aug 27, 2026
82 checks passed
@Lee-W
Lee-W deleted the fix-common-ai-vertex-prefix branch August 27, 2026 23:32
Lee-W added a commit to astronomer/airflow that referenced this pull request Sep 19, 2026
Review of the bare-model-id support on this branch surfaced four ways it
misleads whoever configured the connection.

pydantic-ai's "test" sentinel stopped reaching pydantic-ai: on a generic
connection it raised, and on a vendor connection it silently became
"azure:test" and friends.

A mistyped prefix was reported as a bare model name, telling the user to set
the "provider:model" string they had already set, and never naming the segment
that failed to resolve.

A name forwarded down a fallback chain was attributed to the fallback
connection, which had never carried it, instead of to the primary that set it.

A vendor's own native id was forwarded across platforms, where it resolves
without complaint and only 404s during the outage the chain existed to cover,
while test_connection reports the chain healthy. A prefix left over from a
spelling this provider shipped until apache#72011 resolves the same way, so it is now
logged when a prefixed name is treated as a bare vendor id.
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.

3 participants