You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "olegkachur-e (via GitHub)" <gi...@apache.org> on 2026/06/17 08:56:44 UTC

[PR] Update google provider generative model system test [airflow]

olegkachur-e opened a new pull request, #68665:
URL: https://github.com/apache/airflow/pull/68665

   - Update model picking logic
   - Remove API_KEY dependency
   
    <!-- SPDX-License-Identifier: Apache-2.0
         https://www.apache.org/licenses/LICENSE-2.0 -->
   
   <!--
   Thank you for contributing!
   
   Please provide above a brief description of the changes made in this pull request.
   Write a good git commit message following this guide: http://chris.beams.io/posts/git-commit/
   
   Please make sure that your code changes are covered with tests.
   And in case of new features or big changes remember to adjust the documentation.
   
   For user-facing UI changes, please attach before/after screenshots (or a short
   screen recording) so reviewers can assess the visual impact.
   
   Feel free to ping (in general) for the review if you do not see reaction for a few days
   (72 Hours is the minimum reaction time you can expect from volunteers) - we sometimes miss notifications.
   
   In case of an existing issue, reference it using one of the following:
   
   * closes: #ISSUE
   * related: #ISSUE
   -->
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "VladaZakharova (via GitHub)" <gi...@apache.org>.
VladaZakharova commented on PR #68665:
URL: https://github.com/apache/airflow/pull/68665#issuecomment-4923781015

   @shahar1 hi there :)
   can you please check this one?


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "olegkachur-e (via GitHub)" <gi...@apache.org>.
olegkachur-e commented on code in PR #68665:
URL: https://github.com/apache/airflow/pull/68665#discussion_r3588263744


##########
providers/google/tests/system/google/cloud/gen_ai/example_gen_ai_generative_model_tuning.py:
##########
@@ -118,16 +126,21 @@ def _get_actual_model(key) -> str:
 ) as dag:
 
     @task
-    def get_gemini_api_key():
-        return get_secret(GEMINI_API_KEY)
-
-    get_gemini_api_key_task = get_gemini_api_key()
-
-    @task
-    def get_actual_model(key):
-        return _get_actual_model(key)
-
-    get_actual_model_task = get_actual_model(get_gemini_api_key_task)
+    def get_actual_model():
+        latest_available_model = max(
+            filter(lambda model: model["sft_availability"] == "GenerallyAvailable", STABLE_SFT_MODELS),
+            key=lambda model: model["guaranteed_until"],
+        )
+
+        if datetime.now(timezone.utc).date() > latest_available_model["guaranteed_until"]:
+            msg = (
+                f"The model: {latest_available_model} guarantee date has expired. "
+                f"Please check and update the stable SFT models list according to the official documentation: "
+                f"https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning/supervised-tuning#limitations"
+            )
+            raise ValueError(msg)
+
+        return latest_available_model

Review Comment:
   The idea was to have in xcom a whole dictionary for visibility from the airflow UI and put the reference job on myself :-)



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "olegkachur-e (via GitHub)" <gi...@apache.org>.
olegkachur-e commented on code in PR #68665:
URL: https://github.com/apache/airflow/pull/68665#discussion_r3588227448


##########
providers/google/tests/system/google/cloud/gen_ai/example_gen_ai_generative_model_tuning.py:
##########
@@ -118,16 +126,21 @@ def _get_actual_model(key) -> str:
 ) as dag:
 
     @task
-    def get_gemini_api_key():
-        return get_secret(GEMINI_API_KEY)
-
-    get_gemini_api_key_task = get_gemini_api_key()
-
-    @task
-    def get_actual_model(key):
-        return _get_actual_model(key)
-
-    get_actual_model_task = get_actual_model(get_gemini_api_key_task)
+    def get_actual_model():
+        latest_available_model = max(
+            filter(lambda model: model["sft_availability"] == "GenerallyAvailable", STABLE_SFT_MODELS),
+            key=lambda model: model["guaranteed_until"],
+        )

Review Comment:
   Sounds reasonable, I'll prioritize budget optimal model first.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "shahar1 (via GitHub)" <gi...@apache.org>.
shahar1 commented on code in PR #68665:
URL: https://github.com/apache/airflow/pull/68665#discussion_r3556554528


##########
providers/google/tests/system/google/cloud/gen_ai/example_gen_ai_generative_model_tuning.py:
##########
@@ -118,16 +126,21 @@ def _get_actual_model(key) -> str:
 ) as dag:
 
     @task
-    def get_gemini_api_key():
-        return get_secret(GEMINI_API_KEY)
-
-    get_gemini_api_key_task = get_gemini_api_key()
-
-    @task
-    def get_actual_model(key):
-        return _get_actual_model(key)
-
-    get_actual_model_task = get_actual_model(get_gemini_api_key_task)
+    def get_actual_model():
+        latest_available_model = max(
+            filter(lambda model: model["sft_availability"] == "GenerallyAvailable", STABLE_SFT_MODELS),
+            key=lambda model: model["guaranteed_until"],
+        )
+
+        if datetime.now(timezone.utc).date() > latest_available_model["guaranteed_until"]:
+            msg = (
+                f"The model: {latest_available_model} guarantee date has expired. "
+                f"Please check and update the stable SFT models list according to the official documentation: "
+                f"https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning/supervised-tuning#limitations"
+            )
+            raise ValueError(msg)
+
+        return latest_available_model

Review Comment:
   Instead of returning the entire dictionary, maybe just return `latest_available_model["model_id"]`? (should simplify later references)



##########
providers/google/tests/system/google/cloud/gen_ai/example_gen_ai_generative_model_tuning.py:
##########
@@ -118,16 +126,21 @@ def _get_actual_model(key) -> str:
 ) as dag:
 
     @task
-    def get_gemini_api_key():
-        return get_secret(GEMINI_API_KEY)
-
-    get_gemini_api_key_task = get_gemini_api_key()
-
-    @task
-    def get_actual_model(key):
-        return _get_actual_model(key)
-
-    get_actual_model_task = get_actual_model(get_gemini_api_key_task)
+    def get_actual_model():
+        latest_available_model = max(
+            filter(lambda model: model["sft_availability"] == "GenerallyAvailable", STABLE_SFT_MODELS),
+            key=lambda model: model["guaranteed_until"],
+        )

Review Comment:
   All three GA entries share `guaranteed_until=date(2026, 10, 16)`, so max() tie-breaks to the first listed: gemini-2.5-pro, the most expensive model to fine-tune. The old logic deliberately preferred flash models. If system-test run cost matters, list flash first or filter to flash.



##########
providers/google/tests/system/google/cloud/gen_ai/example_gen_ai_generative_model_tuning.py:
##########
@@ -41,60 +39,70 @@
 except ImportError:
     # Compatibility for Airflow < 3.1
     from airflow.utils.trigger_rule import TriggerRule  # type: ignore[no-redef,attr-defined]
+try:
+    from airflow.sdk import timezone
+except ImportError:
+    # Airflow 2.x fallback path
+    from airflow.utils import timezone  # type: ignore[no-redef,attr-defined]

Review Comment:
   nit: The new airflow.sdk/airflow.utils timezone compat try/except is unnecessary: stdlib from datetime import timezone provides timezone.utc for exactly this use, dropping 5 lines and a type-ignore.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "olegkachur-e (via GitHub)" <gi...@apache.org>.
olegkachur-e commented on PR #68665:
URL: https://github.com/apache/airflow/pull/68665#issuecomment-4981942483

   > Overall LGTM, few comments before approval. Question - sibling tests `example_gen_ai_generative_model.py` and `example_gen_ai_gemini_batch_api.py` still use the removed API-key/REST pattern, is there any plan to refactor them as well?
   
   Yes, we do have, but decided to scope it into separate PR.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "olegkachur-e (via GitHub)" <gi...@apache.org>.
olegkachur-e commented on PR #68665:
URL: https://github.com/apache/airflow/pull/68665#issuecomment-5542472027

   Since it got stuck in review, closing in favor of https://github.com/apache/airflow/pull/72323.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Update google provider generative model system test [airflow]

Posted by "olegkachur-e (via GitHub)" <gi...@apache.org>.
olegkachur-e closed pull request #68665: Update google provider generative model system test
URL: https://github.com/apache/airflow/pull/68665


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org