jlaneve opened a new issue, #75906:
URL: https://github.com/apache/airflow/issues/75906

   ### Description
   
   the generic `pydanticai` connection has no default model provider, so every 
`model_id` on it has to carry a pydantic-ai prefix like 
`openai-chat:claude-sonnet-4-5`. a bare id fails with "Connection '...' has no 
default model provider, so the bare model name '...' cannot be resolved"
   
   the vendor hooks already solve this with a class attribute: 
`PydanticAIAzureHook.model_provider = "azure"`, bedrock and vertex do the same, 
and `_qualify_model_name` prefixes bare ids with it. the generic hook has 
`model_provider = None` and reads only `model` from the extra, so there's no 
way to set one per connection
   
   proposal: an optional `provider` key in the extra of a `pydanticai` 
connection, e.g. `{"provider": "openai-chat"}`. when the hook has no 
class-level `model_provider`, `_qualify_model_name` uses it, and it's checked 
with the same `infer_provider_class` lookup the prefix check already uses, so a 
typo fails at resolve time. ids that already carry a prefix work as before, and 
connections without the key behave exactly as today
   
   ### Use case/motivation
   
   a common setup is one `pydanticai` connection pointed at an 
OpenAI-compatible gateway or proxy (LiteLLM, vLLM, an internal gateway) that 
serves models from several vendors. a platform team creates that connection 
once, and DAG authors then have to know which pydantic-ai prefix matches what 
the gateway speaks
   
   the prefix choice is easy to get wrong. `openai:` resolves to the Responses 
API and `openai-chat:` to Chat Completions, and many OpenAI-compatible servers 
only implement Chat Completions, or only for some models. with `{"provider": 
"openai-chat"}` on the connection, the person who set up the connection makes 
that choice once, and DAG code names models the way the gateway does: 
`@task.llm(llm_conn_id="my_gateway", model_id="claude-sonnet-4-5")`
   
   ### Related issues
   
   none that I found
   
   ### Are you willing to submit a PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's Code of Conduct
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to