kaxil commented on code in PR #74451:
URL: https://github.com/apache/airflow/pull/74451#discussion_r4243797550


##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -873,11 +871,10 @@ def _get_provider_kwargs(
         # "vertexai" predates pydantic-ai splitting GoogleProvider (Generative 
Language API)
         # from GoogleCloudProvider (Vertex AI, which hardcodes vertexai=True 
internally and
         # accepts no such constructor kwarg) in pydantic/pydantic-ai#5336. 
Forwarding it would
-        # raise TypeError, which the base hook's `except TypeError` in 
get_conn() would then
-        # catch: it logs a warning and falls back to env-var auth rather than 
raising --
-        # authenticating as the wrong identity (with *all* other kwargs 
discarded). Accept
-        # the field for backward compatibility but never forward it: which API 
is used is
-        # now controlled by the model prefix.
+        # raise TypeError, which the base hook's `except TypeError` in 
get_conn() would turn
+        # into a ValueError rejecting the whole connection. Accept the field 
for backward

Review Comment:
   With the fail-closed change, a Vertex connection set up like its form 
placeholder (`project` and `location` filled in) plus a `google:` model now 
errors, because this method forwards `project`/`location` whatever the prefix 
and `GoogleProvider` only takes `api_key`/`base_url` (`unexpected keyword 
argument 'project'` on pydantic-ai 2.54). The class docstring ("that spelling 
already works today") and the Model field in 
`docs/connections/pydantic_ai_vertex.rst` ("routes to a different provider 
regardless of which fields this connection sets") only held because of the 
env-var fallback that's now gone. Could both say that `google:` on this 
connection type needs `api_key` and no Vertex-only fields?



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