Skip to content

refactor(py/plugins/google-genai): move Veo to background model actions - #5857

Open
cabljac wants to merge 1 commit into
jh-interactions-3-modelsfrom
jh-interactions-4-veo
Open

refactor(py/plugins/google-genai): move Veo to background model actions#5857
cabljac wants to merge 1 commit into
jh-interactions-3-modelsfrom
jh-interactions-4-veo

Conversation

@cabljac

@cabljac cabljac commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Fourth slice of the #5806 split: rewrites veo.py around create_veo_background_action on the shared background-model plumbing, wires Veo through BACKGROUND_MODEL/CHECK_OPERATION resolution in both GoogleAI and VertexAI (dropping the plain MODEL registration), and updates the google-genai-media sample to poll generate_operation directly. Touches only the Veo hunks of google.py; the Interactions wiring hunks follow in the next slice.

Part of the stack splitting #5806; recombined it reproduces that PR byte-for-byte. Co-authored with @huangjeff5.

Breaking changes

  • Veo is now background-only on both GoogleAI and VertexAI: ai.generate(model='vertexai/veo-...') no longer resolves; use ai.generate_operation(...) + ai.check_operation(...) (see the updated google-genai-media sample).
  • VeoModel and VeoConfigSchema are removed from genkit_google_genai.models.veo; use create_veo_background_action and VeoConfig.

@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 refactors Veo video generation to use the new background model pattern and the GenAI generate_videos long-running API, updating both Google AI and Vertex AI plugins. It simplifies configuration schemas, updates sample code to use generate_operation and check_operation, and adapts the test suite. A critical bug was identified in from_veo_operation where operation.error is treated as a dictionary instead of a Pydantic model, which will cause an AttributeError at runtime.

Comment on lines +147 to 149
if operation.error:
op.error = Error(message=str(operation.error.get('message', 'Unknown error')))
return op

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.

high

The operation.error object is an instance of the Pydantic model Status (from the google-genai SDK), which does not have a .get() method. Calling .get('message') on it will raise an AttributeError at runtime when an error is encountered. Instead, you should access the message attribute directly.

Suggested change
if operation.error:
op.error = Error(message=str(operation.error.get('message', 'Unknown error')))
return op
if operation.error:
op.error = Error(message=operation.error.message or 'Unknown error')
return op

Veo slice extracted from #5806: rewrites veo.py around
create_veo_background_action on the shared background-model plumbing,
wires Veo through BACKGROUND_MODEL/CHECK_OPERATION resolution in both
GoogleAI and VertexAI (dropping the plain MODEL registration), and
updates the google-genai-media sample to poll generate_operation
directly.

Co-authored-by: Jeff Huang <huangjeff@google.com>
@cabljac
cabljac force-pushed the jh-interactions-4-veo branch from dd87f9b to 186c6fd Compare July 30, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation python Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant