You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "dannikay (via GitHub)" <gi...@apache.org> on 2025/12/03 17:50:50 UTC

[PR] Support Vertex Flex API in GeminiModelHandler [beam]

dannikay opened a new pull request, #36982:
URL: https://github.com/apache/beam/pull/36982

   (no comment)


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3608517856

   Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment `assign set of reviewers`


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614322874

   actually mypy is still failing.
   
   ```
   2025-12-04T21:05:36.1516076Z apache_beam/ml/inference/gemini_inference.py:193: error: Unexpected keyword argument "api_version" for "ClientOptions"  [call-arg]
   2025-12-04T21:05:36.1517488Z target/.tox-mypy/mypy/lib/python3.10/site-packages/google/api_core/client_options.py:107: note: "ClientOptions" defined here
   2025-12-04T21:05:36.1518654Z apache_beam/ml/inference/gemini_inference.py:193: error: Unexpected keyword argument "headers" for "ClientOptions"  [call-arg]
   2025-12-04T21:05:36.1519875Z target/.tox-mypy/mypy/lib/python3.10/site-packages/google/api_core/client_options.py:107: note: "ClientOptions" defined here
   2025-12-04T21:05:36.1520949Z apache_beam/ml/inference/gemini_inference.py:193: error: Unexpected keyword argument "timeout" for "ClientOptions"  [call-arg]
   2025-12-04T21:05:36.1522892Z target/.tox-mypy/mypy/lib/python3.10/site-packages/google/api_core/client_options.py:107: note: "ClientOptions" defined here
   2025-12-04T21:05:36.1524279Z apache_beam/ml/inference/gemini_inference.py:193: error: Argument "http_options" to "Client" has incompatible type "ClientOptions"; expected "HttpOptions | HttpOptionsDict | None"  [arg-type]
   ```


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614151903

   Thanks!
   
   1. @jrmccluskey would you recommedn we also add an integration test in sdks/python/apache_beam/ml/inference/gemini_inference_it_test.py ?
   
   2. There is a linter error
   
   Running pylint...
   ************* Module apache_beam.ml.inference.gemini_inference_test
   apache_beam/ml/inference/gemini_inference_test.py:20:0: W0611: Unused mock imported from unittest (unused-import)


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614430069

   python -m pytest apache_beam/ml/inference/gemini_inference_test.py
   
   Successfully set waiting utils config
   =============================================================================================== test session starts ===============================================================================================
   platform linux -- Python 3.13.5, pytest-8.3.4, pluggy-1.6.0
   configfile: pytest.ini
   plugins: timeout-2.4.0, xdist-3.8.0, requests-mock-1.12.1, hypothesis-6.148.3, anyio-4.12.0
   timeout: 600.0s
   timeout method: signal
   timeout func_only: False
   collected 8 items                                                                                                                                                                                                 
   
   apache_beam/ml/inference/gemini_inference_test.py ........                                                                                                                                                  [100%]
   
   ================================================================================================ 8 passed in 3.32s ================================================================================================


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3609239432

   Assigning reviewers:
   
   R: @tvalentyn for label python.
   
   
   Note: If you would like to opt out of this review, comment `assign to next reviewer`.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614595482

   there is still a linter error FYI.


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn merged PR #36982:
URL: https://github.com/apache/beam/pull/36982


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614272839

   > Thanks!
   > 
   > 1. @jrmccluskey would you recommedn we also add an integration test in sdks/python/apache_beam/ml/inference/gemini_inference_it_test.py ?
   > 2. There is a linter error
   > 
   > Running pylint... ************* Module apache_beam.ml.inference.gemini_inference_test apache_beam/ml/inference/gemini_inference_test.py:20:0: W0611: Unused mock imported from unittest (unused-import)
   
   Removed the unused mock. Not sure why "tox -e py3-yapf" is not remove this line.


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614434247

   > actually mypy is still failing.
   > 
   > ```
   > 2025-12-04T21:05:36.1516076Z apache_beam/ml/inference/gemini_inference.py:193: error: Unexpected keyword argument "api_version" for "ClientOptions"  [call-arg]
   > 2025-12-04T21:05:36.1517488Z target/.tox-mypy/mypy/lib/python3.10/site-packages/google/api_core/client_options.py:107: note: "ClientOptions" defined here
   > 2025-12-04T21:05:36.1518654Z apache_beam/ml/inference/gemini_inference.py:193: error: Unexpected keyword argument "headers" for "ClientOptions"  [call-arg]
   > 2025-12-04T21:05:36.1519875Z target/.tox-mypy/mypy/lib/python3.10/site-packages/google/api_core/client_options.py:107: note: "ClientOptions" defined here
   > 2025-12-04T21:05:36.1520949Z apache_beam/ml/inference/gemini_inference.py:193: error: Unexpected keyword argument "timeout" for "ClientOptions"  [call-arg]
   > 2025-12-04T21:05:36.1522892Z target/.tox-mypy/mypy/lib/python3.10/site-packages/google/api_core/client_options.py:107: note: "ClientOptions" defined here
   > 2025-12-04T21:05:36.1524279Z apache_beam/ml/inference/gemini_inference.py:193: error: Argument "http_options" to "Client" has incompatible type "ClientOptions"; expected "HttpOptions | HttpOptionsDict | None"  [arg-type]
   > ```
   
   The ClientOption was swapped somehow by some autocompletion tool. I should have checked more thoroughly. Now verified locally that all unit tests pass.


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "jrmccluskey (via GitHub)" <gi...@apache.org>.
jrmccluskey commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614161616

   Seems like adding a small integration test case would be reasonable for this, just as an extra sanity check


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614648594

   yeah, isort is a separate check.
   
   you might be able to also run `gradlew lint` locally.
   
   @jrmccluskey do you by chance have instructions for running isort locally, similar to https://github.com/apache/beam/blob/master/contributor-docs/python-tips.md#running-yapf-formatter-manually ?


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614257200

   > Seems like adding a small integration test case would be reasonable for this, just as an extra sanity check
   
   Integration testing isn't possible at the moment:
   - The API is not publicly available
   - Project apache-beam-testing is not yet allowlisted
   - We're not allowed to do automated testing against their non-public API (oneoff is fine but you need to jump through hoops to get allowlisted)
   
   We can add one once the API is launched publicly. WDYT?


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3615127175

   The remaining one failed check seems to be a flake:
   
   ```
   Prepare all required actions
   Getting action download info
   Download action repository 'actions/setup-python@v5' (SHA:a26af69be951a213d495a4c3e4e4022e16d87065)
   Download action repository 'actions/cache@v3' (SHA:6f8efc29b200d32929f49075959781ed54ec270c)
   Download action repository 'actions/setup-java@v3' (SHA:17f84c3641ba7b8f6deff6309fc4c864478f5d62)
   Download action repository 'gradle/gradle-build-action@v2' (SHA:a8f75513eafdebd8141bd1cd4e30fcd194af8dfa)
   Download action repository 'actions/setup-go@v6' (SHA:4dc6199c7b1a012772edbd06daecab0f50c9053c)
   Run ./.github/actions/setup-environment-action
   Run actions/setup-python@v5
   Installed versions
     Version 3.11 was not found in the local cache
     Version 3.11 is available for downloading
     Download from "https://github.com/actions/python-versions/releases/download/3.11.12-14343939122/python-3.11.12-linux-20.04-x64.tar.gz"
     Unexpected HTTP response: 404
     Error: Unexpected HTTP response: 404
   ```


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3609236574

   assign set of reviewers


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
gemini-code-assist[bot] commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3608074928

   ## Summary of Changes
   
   Hello @dannikay, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
   
   This pull request enhances the `GeminiModelHandler` by integrating support for the Vertex AI Flex API. This allows users to specify whether to use the Flex API when interacting with Gemini models, providing more granular control over the underlying API calls, such as setting custom HTTP headers and timeouts. The change ensures that the `genai.Client` is configured correctly based on this new option, improving flexibility for Vertex AI deployments.
   
   ### Highlights
   
   * **Vertex AI Flex API Support**: Introduced a new parameter, `use_vertex_flex_api`, to the `GeminiModelHandler` to enable support for the Vertex AI Flex API.
   * **Configurable Client Options**: The `genai.Client` can now be configured with specific `http_options` (including `api_version`, custom headers like `X-Vertex-AI-LLM-Request-Type`, and a timeout) when `use_vertex_flex_api` is enabled.
   * **Unit Testing**: Added a new unit test to verify that the `genai.Client` is correctly initialized with the appropriate `HttpOptions` when the Flex API is utilized.
   
   
   
   
   
   
   
   <details>
   <summary><b>Using Gemini Code Assist</b></summary>
   <br>
   
   The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips.
   
   <b>Invoking Gemini</b>
   
   You can request assistance from Gemini at any point by creating a comment using either `/gemini <command>` or `@gemini-code-assist <command>`. Below is a summary of the supported commands on the current page.
   
   Feature | Command | Description
   --- | --- | ---
   Code Review | `/gemini review` | Performs a code review for the current pull request in its current state.
   Pull Request Summary | `/gemini summary` | Provides a summary of the current pull request in its current state.
   Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments.
   Help | `/gemini help` | Displays a list of available commands.
   
   <b>Customization</b>
   
   To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a `.gemini/` folder in the base of the repository. Detailed instructions can be found [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github).
   
   <b>Limitations & Feedback</b>
   
   Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up [here](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG).
   
   <b>You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the [Gemini Code Assist IDE Extension](https://cloud.google.com/products/gemini/code-assist).</b>
   </details>
   
   
   
   
   [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487).
   


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "dannikay (via GitHub)" <gi...@apache.org>.
dannikay commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614632943

   > there is still a linter error FYI.
   
   it complains about this import syntax:
   
   ```
   +++ /runner/_work/beam/beam/sdks/python/test-suites/tox/pycommon/build/srcs/sdks/python/apache_beam/ml/inference/gemini_inference.py:after	2025-12-04 21:47:38.526115
   @@ -25,7 +25,8 @@
    
    from google import genai
    from google.genai import errors
   -from google.genai.types import HttpOptions, Part
   +from google.genai.types import HttpOptions
   +from google.genai.types import Part
    from PIL.Image import Image
   ```
   
   my local check passed:
   
   ```
   yapf --diff apache_beam/ml/inference/gemini_inference.py
   (base) xiaochu@xiaochu:~/github/beam/sdks/python$ pylint apache_beam/ml/inference/gemini_inference.py
   
   --------------------------------------------------------------------
   Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
   ```
   
   But anyway let me follow the check's preference.


-- 
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: github-unsubscribe@beam.apache.org

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


Re: [PR] Support Vertex Flex API in GeminiModelHandler [beam]

Posted by "tvalentyn (via GitHub)" <gi...@apache.org>.
tvalentyn commented on PR #36982:
URL: https://github.com/apache/beam/pull/36982#issuecomment-3614317819

   yapf changes formatting but doesn't modify content semantically.


-- 
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: github-unsubscribe@beam.apache.org

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