feat(py): support Google AI Interactions and background models (Veo, Deep Research, Antigravity, Lyria) - #5806
feat(py): support Google AI Interactions and background models (Veo, Deep Research, Antigravity, Lyria)#5806huangjeff5 wants to merge 29 commits into
Conversation
…) 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.
There was a problem hiding this comment.
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.
Drop the hand-rolled Interactions client/types, bump to google-genai 2.x, and tighten config/error/FinishReason handling from PR review.
…d deep research samples
…i_name registration pattern
…archy and metadata persistence
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_generate_echoes_normalized_effective_config(mocker: MockerFixture) -> None: |
There was a problem hiding this comment.
Ideally, we don't mutate the original ModelRequest here.
|
|
||
| @pytest.mark.asyncio | ||
| async def test_generate_echoes_injected_modalities_when_config_omitted( | ||
| mocker: MockerFixture, |
There was a problem hiding this comment.
Is this because response_modalities is part of the default config? Need more context
- 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>
|
Hey Jeff - as discussed, here's the split, stacked so each slice reviews independently:
Recombining the stack reproduces this branch's tree byte-for-byte, and you're co-author on every commit. Closing this one as superseded by the stack. |
…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>
…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>
… 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>
… 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>
…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>
Adds support for various background models on Interactions API.
Also adds support for Veo on the legacy API (Veo isn't on Interactions API).