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


##########
providers/common/ai/src/airflow/providers/common/ai/plugins/hitl_review.py:
##########
@@ -21,16 +21,12 @@
 import mimetypes
 from pathlib import Path
 from types import SimpleNamespace
-from typing import Annotated, Any
+from typing import Any
 from urllib.parse import urlparse
 
-from fastapi import Depends, FastAPI, HTTPException, Query
-from fastapi.staticfiles import StaticFiles
 from sqlalchemy import select

Review Comment:
   On Airflow < 3.1, none of the helper functions (`_read_xcom`, `_write_xcom`, 
`_build_session_response`, etc.) are reachable since the routes that call them 
don't exist. The sqlalchemy, `airflow.models`, and `airflow.utils` imports on 
lines 27-47 load ORM models and session machinery that goes unused. Consider 
moving these inside the `if AIRFLOW_V_3_1_PLUS:` block too, so < 3.1 only pays 
for the version check and the empty plugin class. Can be a follow-up.



##########
providers/common/ai/src/airflow/providers/common/ai/plugins/hitl_review.py:
##########
@@ -231,295 +214,312 @@ def _build_session_response(
     )
 
 
-hitl_review_app = FastAPI(
-    title="HITL Review",
-    description=(
-        "REST API and chat UI for human-in-the-loop LLM feedback sessions.  "
-        "Sessions are stored in XCom entries on the running task instance."
-    ),
-)
+if AIRFLOW_V_3_1_PLUS:
+    from typing import Annotated

Review Comment:
   `Annotated` is from `typing` (stdlib, available since Python 3.9). It 
doesn't need to be inside the `AIRFLOW_V_3_1_PLUS` guard -- it could stay at 
the top with the other `typing` imports alongside `Any`. Minor nit.



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