Skip to content

Commit 96f123b

Browse files
committed
Resolve ci failures
1 parent a5f9116 commit 96f123b

7 files changed

Lines changed: 17 additions & 17 deletions

File tree

docs/spelling_wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,7 @@ init
817817
initdb
818818
initialisation
819819
initialiser
820+
initialises
820821
initialising
821822
initializer
822823
inout

providers/common/ai/docs/changelog.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@
2525
Changelog
2626
---------
2727

28-
Next release
29-
............
30-
31-
Features
32-
^^^^^^^^
33-
34-
* Add ``BaseAIHook`` contract with framework-agnostic ``create_agent`` / ``run_agent`` /
35-
``get_model`` interface so ``AgentOperator`` selects the agent backend via connection type.
36-
3728
0.3.0
3829
.....
3930

providers/common/ai/provider.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ integrations:
6161
tags: [ai]
6262

6363
hooks:
64+
- integration-name: Base Hook
65+
python-modules:
66+
- airflow.providers.common.ai.hooks.base_ai
6467
- integration-name: Pydantic AI
6568
python-modules:
6669
- airflow.providers.common.ai.hooks.pydantic_ai

providers/common/ai/src/airflow/providers/common/ai/get_provider_info.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ def get_provider_info():
6767
},
6868
],
6969
"hooks": [
70+
{
71+
"integration-name": "Base Hook",
72+
"python-modules": ["airflow.providers.common.ai.hooks.base_ai"],
73+
},
7074
{
7175
"integration-name": "Pydantic AI",
7276
"python-modules": ["airflow.providers.common.ai.hooks.pydantic_ai"],

providers/common/ai/src/airflow/providers/common/ai/hooks/base_ai.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import json
2424
import time
2525
from abc import ABCMeta, abstractmethod
26-
from collections.abc import Callable
26+
from collections.abc import Callable, Sequence
2727
from dataclasses import dataclass, field
2828
from typing import Any, ClassVar
2929

@@ -123,7 +123,8 @@ class AgentRunRequest:
123123
framework-neutral structure, so that :class:`~airflow.providers.common.ai.operators.agent.AgentOperator`
124124
has zero framework-specific imports.
125125
126-
:param prompt: User prompt for this invocation.
126+
:param prompt: User prompt for this invocation (plain ``str`` or a multimodal
127+
``Sequence`` accepted by the backend agent's run API).
127128
:param output_type: Expected structured output type (default: ``str``).
128129
:param instructions: System-level instructions for the agent.
129130
:param toolsets: List of :class:`BaseToolset` instances the agent may call.
@@ -135,7 +136,7 @@ class AgentRunRequest:
135136
Use this escape hatch for framework-specific options.
136137
"""
137138

138-
prompt: str
139+
prompt: str | Sequence[Any]
139140
output_type: type[Any] = str
140141
instructions: str = ""
141142
toolsets: list[Any] | None = None

providers/common/ai/src/airflow/providers/common/ai/hooks/pydantic_ai.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def get_model(self) -> Model:
141141
if self._model is not None:
142142
return self._model
143143

144-
conn = self.get_connection(self.llm_conn_id)
144+
conn = self.get_connection(self.llm_conn_id or self.default_conn_name)
145145

146146
extra: dict[str, Any] = conn.extra_dejson
147147
model_name: str | KnownModelName = self.model_id or extra.get("model", "")
@@ -271,7 +271,10 @@ def run_agent(self, agent: Agent[None, Any], request: AgentRunRequest) -> AgentR
271271
if storage is not None and counter is not None:
272272
from airflow.providers.common.ai.durable.caching_model import CachingModel
273273

274-
resolved_model = infer_model(agent.model)
274+
if agent.model is None:
275+
raise ValueError("Agent model must be set when durable=True")
276+
model = agent.model
277+
resolved_model = infer_model(model) if isinstance(model, str) else model
275278
caching_model = CachingModel(
276279
resolved_model,
277280
storage=storage,

providers/common/ai/tests/unit/common/ai/decorators/test_agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ def test_execute_raises_on_invalid_prompt(self, return_value):
7777

7878
def test_execute_accepts_sequence_prompt(self):
7979
"""A non-empty Sequence[UserContent] return value is forwarded as-is."""
80-
from pydantic_ai.messages import ImageUrl
8180

8281
image = ImageUrl(url="https://example.com/x.png")
8382
prompt = ["Describe this:", image]
@@ -101,8 +100,6 @@ def test_sequence_prompt_with_hitl_review_raises(self):
101100
if not AIRFLOW_V_3_1_PLUS:
102101
pytest.skip("enable_hitl_review requires Airflow >= 3.1.0")
103102

104-
from pydantic_ai.messages import ImageUrl
105-
106103
op = _AgentDecoratedOperator(
107104
task_id="test",
108105
python_callable=lambda: ["x", ImageUrl(url="https://example.com/x.png")],

0 commit comments

Comments
 (0)