Skip to content

feat(py/plugins/google-genai): Add Virtual Try-On 001 on VertexAI#5181

Draft
cabljac wants to merge 3 commits into
mainfrom
feat/py-vertexai-virtual-try-on
Draft

feat(py/plugins/google-genai): Add Virtual Try-On 001 on VertexAI#5181
cabljac wants to merge 3 commits into
mainfrom
feat/py-vertexai-virtual-try-on

Conversation

@cabljac
Copy link
Copy Markdown
Contributor

@cabljac cabljac commented Apr 23, 2026

Adds virtual-try-on-001 image editing to the VertexAI backend.

Callers tag input images with metadata={'type': 'personImage' | 'productImage'} on the ai.Part — same convention as the Go PR #5177. The google-genai Python SDK does not expose a VTO method, so the model driver issues the :predict call directly through the SDK's authenticated _api_client.async_request, reusing the plugin's existing credentials / quota headers / tracing. Empty predictions surface as a FinishReason.BLOCKED response, not an exception.

Testing

image image image image

Adds virtual-try-on-001 image editing to the VertexAI plugin.

- New models/virtual_try_on.py module with VirtualTryOnConfig,
  VirtualTryOnModel, and helper functions mirroring the JS
  ImagenTryOnConfigSchema and the Go PR #5177 design.
- Caller identifies person vs product images via a "type" key in
  ai.Part metadata (PART_METADATA_TYPE_PERSON_IMAGE and
  PART_METADATA_TYPE_PRODUCT_IMAGE), matching the cross-runtime
  convention used by Go.
- The google-genai Python SDK does not expose a VTO method, so the
  model driver issues the :predict call directly through the SDK's
  authenticated _api_client.async_request, so credentials, quota
  headers, and tracing come from the plugin's existing client config.
- Empty predictions surface as a FinishReason.BLOCKED ModelResponse
  (matching the Go post-review behaviour), not an exception.
- VertexAI plugin registers the hardcoded known-model list so VTO
  appears in Init and list_actions even when client.models.list()
  does not surface it.
- Adds unit tests for the helpers and generate() flow.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Virtual Try-On models in the Google GenAI plugin, including the VirtualTryOnModel driver, configuration schemas, and logic for processing person and product image media parts. Unit tests were also added to ensure correct request formatting and response parsing. Feedback was provided regarding the need for consistent error handling when calling the underlying API client to ensure exceptions are properly mapped to Genkit errors.

Comment thread py/plugins/google-genai/src/genkit/plugins/google_genai/models/virtual_try_on.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants