From 3bcb10c962f385cfda5aa7ad2a73c1a1c2331ac3 Mon Sep 17 00:00:00 2001 From: Andrew Chang Date: Thu, 24 Sep 2026 17:22:10 +0800 Subject: [PATCH] Fix mypy error in common.ai decision helper with pydantic-ai 2.46 pydantic-ai-slim 2.46.0 exports Choice and Choices, so mypy now infers the aliased import names as those types and rejects the None fallback assigned to them when the import fails. The CI environment upgrade to 2.46.0 fails the providers mypy check on this line. --- .../ai/src/airflow/providers/common/ai/utils/decision.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py b/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py index aaf1bc504a06e..6d7a94d49a3f7 100644 --- a/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py +++ b/providers/common/ai/src/airflow/providers/common/ai/utils/decision.py @@ -99,8 +99,9 @@ def _choice_types() -> tuple[Any, Any]: Choices as loaded_choices, ) except ImportError: # pydantic-ai < 2.46.0: build the same schema from an Enum instead - loaded_choice = loaded_choices = None - Choice, Choices = loaded_choice, loaded_choices + Choice = Choices = None + else: + Choice, Choices = loaded_choice, loaded_choices return Choice, Choices