Repository navigation
common-ai: let a generic pydanticai connection set a default model provider - #75909
Merged
Merged
Conversation
The generic pydanticai connection has no platform of its own, so every model id on it needs a pydantic-ai prefix such as "openai-chat:". A connection pointed at an OpenAI-compatible gateway then makes every DAG author pick the prefix the gateway speaks. An optional "provider" key in the connection extra (shown as Default Provider in the form) now qualifies bare model ids on that connection, including when they are forwarded down a fallback chain. The value is checked with infer_provider_class, so an unknown provider fails when the model is resolved. Vendor connection types keep their own platform and ignore the key. Prefixed ids and connections without the key behave as before. closes: apache#75906
kaxil
reviewed
Oct 28, 2026
Member
|
Just posted comments so I don't forget, but I'll tackle them |
…ame:tag ids @task.llm_batch read the same Model field but passed it to dispatch unqualified, so a bare name on a Default Provider connection failed, and `openai-chat:` had no batch adapter. The batch operator now qualifies the batch-level and per-request model the way PydanticAIHook does, and `openai-chat` selects the OpenAI adapter, which already submits to Chat Completions. The typo warning for an unrecognized `prefix:` now fires only on vendor types: behind a generic connection's Default Provider, `llama3:70b` is the normal spelling. Docs scope the resolution rule to sources 1-3, note how to send a `mistral:7b`-style tag through a gateway, and list `openai-chat:` for vLLM.
…vider The form label and the extra key both said "provider", which in an Airflow connection form reads as an Airflow provider package. The label is now "Default Model Provider" and the key is `model_provider`, matching the hook's own `model_provider` attribute and its "no default model provider" errors. Nothing has shipped with the old key, so there is nothing to deprecate.
kaxil
approved these changes
Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
a generic
pydanticaiconnection had no platform of its own, so a baremodel_idfailed with "Connection '...' has no default model provider, so the bare model name '...' cannot be resolved". a connection pointed at an OpenAI-compatible gateway made every DAG author pick the right pydantic-ai prefix, andopenai:(Responses API) vsopenai-chat:(Chat Completions) is easy to get wrongan optional
model_providerkey in the extra (shown in the form as Default Model Provider, named after the hook'smodel_providerattribute so it does not read as an Airflow provider package) now qualifies bare ids on a generic connection:{"model_provider": "openai-chat"}with that set,
@task.llm(llm_conn_id="my_gateway", model_id="claude-sonnet-4-5")resolves toopenai-chat:claude-sonnet-4-5infer_provider_classlookup the prefix check uses, so a typo raises when the model is resolved, even if the model id carries its own prefixmodel_providerand ignore the key, since their credential fields only fit their own platformmodel_provider, and the colon-bearing-id gate compares it like a class attribute@task.llm_batchapplies it the same way, tomodel_id, the Model field and a request'smodel, andopenai-chat:selects the OpenAI batch adapter, which already submits to Chat Completionsprefix:now fires only on vendor types, because behind a gatewayllama3:70bis the normal spellingdocs: the pydanticai connection page documents Default Model Provider and adds an OpenAI-compatible gateway example, and the troubleshooting, model providers, fallback and self-hosted pages no longer say a bare name always fails. The
@task.llm_batchpage covers Default Model Provider andopenai-chat:through a gateway.provider.yamlgets the matching conn-fieldcloses: #75906
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Opus 5.5) following the guidelines
{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.