diff --git a/providers/common/ai/provider.yaml b/providers/common/ai/provider.yaml index 814a850a20b6b..158a36a61bd8e 100644 --- a/providers/common/ai/provider.yaml +++ b/providers/common/ai/provider.yaml @@ -193,6 +193,7 @@ connection-types: - Heroku - Hugging Face - LiteLLM + - Meta - Mistral AI - Moonshot AI - Nebius diff --git a/providers/common/ai/src/airflow/providers/common/ai/get_provider_info.py b/providers/common/ai/src/airflow/providers/common/ai/get_provider_info.py index 97364eb0c5030..188a2831d0f34 100644 --- a/providers/common/ai/src/airflow/providers/common/ai/get_provider_info.py +++ b/providers/common/ai/src/airflow/providers/common/ai/get_provider_info.py @@ -165,6 +165,7 @@ def get_provider_info(): "Heroku", "Hugging Face", "LiteLLM", + "Meta", "Mistral AI", "Moonshot AI", "Nebius", diff --git a/providers/common/ai/tests/unit/common/ai/test_provider_metadata.py b/providers/common/ai/tests/unit/common/ai/test_provider_metadata.py index cdc17b932c773..c235d109b829f 100644 --- a/providers/common/ai/tests/unit/common/ai/test_provider_metadata.py +++ b/providers/common/ai/tests/unit/common/ai/test_provider_metadata.py @@ -76,6 +76,7 @@ def _extract_toolset_block() -> dict: "heroku": "Heroku", "huggingface": "Hugging Face", "litellm": "LiteLLM", + "meta": "Meta", "mistral": "Mistral AI", "moonshotai": "Moonshot AI", "nebius": "Nebius", @@ -108,8 +109,10 @@ def _extract_toolset_block() -> dict: # routes to -- `infer_model("voyageai:...")` / `infer_model("sentence-transformers:...")` # raise `UserError: Unknown model`, confirmed by `test_unreachable_modules_stay_unreachable` # below. Not listed in `LABELS`/`provider.yaml` because there is no `common.ai` code path -# (chat or embedding) that reaches them. -UNREACHABLE_MODULES = {"voyageai", "sentence_transformers"} +# (chat or embedding) that reaches them. `elevenlabs` (added in pydantic-ai-slim 2.59.0) is +# the same: its provider only backs ElevenLabs speech/realtime models, which `infer_model` +# does not route to (`UserError: Unknown model: elevenlabs:...`, checked on 2.59.0). +UNREACHABLE_MODULES = {"voyageai", "sentence_transformers", "elevenlabs"} # Modules that ARE reachable through `infer_model` (unlike UNREACHABLE_MODULES) but are # excluded by decision because pydantic-ai itself marks the upstream backend dead: @@ -147,7 +150,12 @@ def _extract_toolset_block() -> dict: # pydantic-ai gives one of these providers an `api_key`/`base_url` constructor parameter, this # must fail so a human re-evaluates whether the module belongs back in `LABELS` and # `provider.yaml`, instead of it staying excluded forever on a stale rationale. -HOOK_INCOMPATIBLE_AUTH_MODULES = {"openai_codex"} +HOOK_INCOMPATIBLE_AUTH_MODULES = {"openai_codex", "openai_chatgpt"} + +# `openai_chatgpt` (pydantic-ai-slim 2.59.0, "Sign in with ChatGPT" plan usage) is excluded for +# the same reason as `openai_codex`: `OpenAIChatGPTProvider.__init__` accepts only `credentials`, +# `credential_source`, `openai_client` and `http_client`, so the `api_key`/`base_url` the hook +# sends cannot reach it; only an OAuth sign-in flow the hook cannot express can. # `pydantic_ai.providers.openai_codex` (the sole `HOOK_INCOMPATIBLE_AUTH_MODULES` member) was # added in pydantic-ai-slim 2.41.0 -- absent on 2.40.0 and below (bisected empirically; the @@ -155,6 +163,12 @@ def _extract_toolset_block() -> dict: # so on the floor it would raise `ModuleNotFoundError` instead of testing anything. OPENAI_CODEX_AVAILABLE_FROM = Version("2.41.0") +# First pydantic-ai-slim release carrying each `HOOK_INCOMPATIBLE_AUTH_MODULES` member. +HOOK_INCOMPATIBLE_AUTH_MODULES_AVAILABLE_FROM = { + "openai_codex": OPENAI_CODEX_AVAILABLE_FROM, + "openai_chatgpt": Version("2.59.0"), +} + requires_openai_codex_module = pytest.mark.skipif( Version(Version(version("pydantic-ai-slim")).base_version) < OPENAI_CODEX_AVAILABLE_FROM, reason=( @@ -167,14 +181,14 @@ def _extract_toolset_block() -> dict: # supports `pydantic-ai-slim>=2.33.0` (`pyproject.toml`) and CI's "Low dep tests" job installs # exactly that floor. Vendors upstream added after the floor are legitimately absent there -- # bisected empirically: `vllm` landed in 2.38.0, `github_copilot` in 2.42.0, `typesafe` in -# 2.45.0, `system_one` in 2.53.0 and `openai_decisions` in 2.55.0 (`openai_codex` also landed +# 2.45.0, `system_one` in 2.53.0 and `openai_decisions` in 2.55.0 and `meta` in 2.59.0 (`openai_codex` also landed # after the floor, in 2.41.0, but is excluded from this reasoning -- see # `OPENAI_CODEX_AVAILABLE_FROM` above) -- so only the "installed but not declared" direction # holds on every supported version. The opposite direction ("declared but not installed") is a # real drift signal solely from the release that carries every vendor currently declared, i.e. -# the latest of them, `openai_decisions`'s 2.55.0: raise this when a newly declared vendor lands +# the latest of them, `meta`'s 2.59.0: raise this when a newly declared vendor lands # in a later release. -ALL_DECLARED_VENDORS_AVAILABLE_FROM = Version("2.55.0") +ALL_DECLARED_VENDORS_AVAILABLE_FROM = Version("2.59.0") requires_all_declared_vendors = pytest.mark.skipif( Version(Version(version("pydantic-ai-slim")).base_version) < ALL_DECLARED_VENDORS_AVAILABLE_FROM, @@ -341,7 +355,10 @@ def test_hook_incompatible_auth_modules_stay_incompatible(self): re-evaluates whether the module belongs back in ``LABELS`` and ``provider.yaml``, instead of it staying excluded forever on a stale rationale. """ + installed = Version(Version(version("pydantic-ai-slim")).base_version) for module in HOOK_INCOMPATIBLE_AUTH_MODULES: + if installed < HOOK_INCOMPATIBLE_AUTH_MODULES_AVAILABLE_FROM[module]: + continue mod = importlib.import_module(f"pydantic_ai.providers.{module}") provider_classes = _provider_classes_in_module(mod) for cls in provider_classes: