refactor(py/plugins/google-genai): move Veo to background model actions - #5857
refactor(py/plugins/google-genai): move Veo to background model actions#5857cabljac wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
| if operation.error: | ||
| op.error = Error(message=str(operation.error.get('message', 'Unknown error'))) | ||
| return op |
There was a problem hiding this comment.
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.
| 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 |
24e73cf to
dd87f9b
Compare
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>
dd87f9b to
186c6fd
Compare
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
ai.generate(model='vertexai/veo-...')no longer resolves; useai.generate_operation(...)+ai.check_operation(...)(see the updated google-genai-media sample).VeoModelandVeoConfigSchemaare removed fromgenkit_google_genai.models.veo; usecreate_veo_background_actionandVeoConfig.