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


##########
providers/common/ai/pyproject.toml:
##########
@@ -69,7 +69,7 @@ dependencies = [
     "apache-airflow>=3.0.0",
     "apache-airflow-providers-common-compat>=1.14.1",
     "apache-airflow-providers-standard>=1.12.1",
-    "pydantic-ai-slim>=1.71.0",
+    "pydantic-ai-slim>=1.72.0",

Review Comment:
   Quick question on the floor bump to `1.72.0`: what does it give us here? I 
diffed both wheels and `Agent.from_spec`/`from_file` are byte-for-byte 
identical in `1.71.0` (same source), so the spec loading works on `1.71.0` too 
-- and that floor only just landed in #67444. If there's a specific `1.72.0` 
fix you're relying on, worth a line in the description; otherwise keeping 
`1.71.0` avoids nudging the floor (plus README/docs/uv.lock) again so soon.



##########
providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py:
##########
@@ -171,6 +172,17 @@ def _provider_factory(pname: str) -> Any:
         self._model = infer_model(model_name)
         return self._model
 
+    def _get_conn_if_model_configured(self) -> Model | None:
+        """Return the hook model only when the hook or connection explicitly 
configures one."""
+        if self.model_id:
+            return self.get_conn()
+
+        conn = self.get_connection(self.llm_conn_id)

Review Comment:
   Small nit: on the no-`model_id` path this fetches the connection twice -- 
`get_connection()` here, then `get_conn()` calls `get_connection()` again. It 
also re-derives the `model_id or extra["model"]` rule that already lives in 
`get_conn()`, so the two can drift if that resolution ever changes. Could 
resolve once, or have `get_conn()` surface whether a model was configured.



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