Skip to content

feat(py): support Google AI Interactions and background models (Veo, Deep Research, Antigravity, Lyria) - #5806

Closed
huangjeff5 wants to merge 29 commits into
mainfrom
jh-interactions
Closed

feat(py): support Google AI Interactions and background models (Veo, Deep Research, Antigravity, Lyria)#5806
huangjeff5 wants to merge 29 commits into
mainfrom
jh-interactions

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Adds support for various background models on Interactions API.

Also adds support for Veo on the legacy API (Veo isn't on Interactions API).

…) patch

Includes: Track 0 generate plumbing, Interactions port, Veo LRO background model, Deep Research/Antigravity/Lyria, samples, DR ModelRef fix, Veo done normalize, lyria-* resolve, requires_action fallthrough (match JS), failed→done=True.

Live smoke: Veo + Deep Research generate_operation paths PASS. Closed GitHub PR #5798 in favor of this patch for review.
@github-actions github-actions Bot added docs Improvements or additions to documentation python Python config root labels Jul 23, 2026

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

Copy link
Copy Markdown
Contributor

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 Google AI Interactions-backed models (such as Deep Research, Antigravity, and Google AI Lyria) in the Genkit Google Genai Python plugin, adding a raw HTTP client, type definitions, and converters. It also refactors background model registration and polling logic, aligning Veo and Deep Research models with Genkit's background model architecture. The review feedback highlights several opportunities to improve robustness and code quality, including avoiding using exceptions for successful control flow, ensuring recursive schema cleaning for nested lists, explicitly mapping HTTP 401 and 403 status codes, recursively normalizing nested Pydantic models in configuration helpers, and defensively handling malformed data URLs.

Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/_interactions/client.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/_interactions/client.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/_interactions/__init__.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/_interactions/client.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/models/veo.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/models/antigravity.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/_interactions/types.py Outdated
Drop the hand-rolled Interactions client/types, bump to google-genai 2.x,
and tighten config/error/FinishReason handling from PR review.
Comment thread py/packages/genkit/src/genkit/_core/_background.py
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/models/antigravity.py Outdated
Comment thread py/packages/genkit-google-genai/tests/interactions/interactions_utils_test.py Outdated


@pytest.mark.asyncio
async def test_generate_echoes_normalized_effective_config(mocker: MockerFixture) -> None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ideally, we don't mutate the original ModelRequest here.


@pytest.mark.asyncio
async def test_generate_echoes_injected_modalities_when_config_omitted(
mocker: MockerFixture,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this because response_modalities is part of the default config? Need more context

Comment thread py/packages/genkit/src/genkit/_core/_background.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/models/deep_research.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/models/deep_research.py Outdated
Comment thread py/packages/genkit-google-genai/src/genkit_google_genai/models/deep_research.py Outdated
Comment thread py/packages/genkit/src/genkit/_core/_action.py
huangjeff5 and others added 2 commits July 27, 2026 14:26
- Interactions: drop shared/ephemeral genai.Client reuse; raw HTTP via get_cached_client (create/get/cancel)
- Non-mutating config partition_keys; Lyria rest passthrough
- Wave2 review fixes: ConfigT reuse, api_key_from_operation, don't mutate ModelRequest, antigravity env preflight removed
- Added _interactions/client.py and interactions_client_test.py
…actions/converters.py

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@cabljac

cabljac commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Hey Jeff - as discussed, here's the split, stacked so each slice reviews independently:

  1. feat(py): core support for background model operations and typed model refs #5854 - core background-operation plumbing + typed model refs (base)
  2. feat(py/plugins/google-genai): raw Interactions HTTP client, converters, and options #5855 - Interactions HTTP client, converters, options
  3. feat(py/plugins/google-genai): Deep Research, Antigravity, and Lyria interaction models #5856 - Deep Research / Antigravity / Lyria models
  4. refactor(py/plugins/google-genai): move Veo to background model actions #5857 - Veo -> background model actions
  5. feat(py/plugins/google-genai): wire Interactions models into GoogleAI plugin #5858 - GoogleAI plugin wiring
  6. feat(py/plugins/google-genai): finish_message for image models and effective config echo #5859 - gemini finish_message (parallel, based on feat(py): core support for background model operations and typed model refs #5854)

Recombining the stack reproduces this branch's tree byte-for-byte, and you're co-author on every commit. google.py was the only file that had to split across two PRs (Veo hunks in #5857, wiring in #5858). Breaking changes are called out per-PR.

Closing this one as superseded by the stack.

@cabljac cabljac closed this Jul 30, 2026
cabljac added a commit that referenced this pull request Jul 30, 2026
…l refs

Core plumbing extracted from #5806: FinishReason.ABORTED (schema + typing),
cancel-operation action kind and registry lookup, background operation
lifecycle updates in _background.py, generate_operation/check_operation
plumbing in _ai, and a config_schema parameter on model_ref.

Co-authored-by: Jeff Huang <huangjeff@google.com>
cabljac added a commit that referenced this pull request Jul 30, 2026
…fective config echo

Gemini slice extracted from #5806: normalizes finish reasons (NO_IMAGE,
IMAGE_OTHER), synthesizes finish_message when image models return no
media so empty results are not silent successes, propagates
finish_message onto candidates, echoes the normalized effective config
on response.request for debugging, and drops the retired
gemini-2.5-flash-image-preview registration.

Co-authored-by: Jeff Huang <huangjeff@google.com>
cabljac added a commit that referenced this pull request Jul 30, 2026
… plugin

Wiring slice extracted from #5806: registers the Deep Research,
Antigravity, and Lyria catalogs in GoogleAI init/resolve/list_actions
(including cancel-operation routing), threads plugin-level ClientOptions
and API key into the Interactions models, maps genai errors in Imagen,
and adds the google-genai-deep-research sample.

Co-authored-by: Jeff Huang <huangjeff@google.com>
cabljac added a commit that referenced this pull request Jul 30, 2026
… plugin

Wiring slice extracted from #5806: registers the Deep Research,
Antigravity, and Lyria catalogs in GoogleAI init/resolve/list_actions
(including cancel-operation routing), threads plugin-level ClientOptions
and API key into the Interactions models, maps genai errors in Imagen,
and adds the google-genai-deep-research sample.

Co-authored-by: Jeff Huang <huangjeff@google.com>
cabljac added a commit that referenced this pull request Jul 30, 2026
…fective config echo

Gemini slice extracted from #5806: normalizes finish reasons (NO_IMAGE,
IMAGE_OTHER), synthesizes finish_message when image models return no
media so empty results are not silent successes, propagates
finish_message onto candidates, echoes the normalized effective config
on response.request for debugging, and drops the retired
gemini-2.5-flash-image-preview registration.

Co-authored-by: Jeff Huang <huangjeff@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config docs Improvements or additions to documentation python Python root tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants