Repository navigation
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
dd87f9b to
186c6fd
Compare
186c6fd to
2292e9e
Compare
| if is_veo_model(clean_name): | ||
| return None | ||
| return self._resolve_model(name) | ||
| elif action_type == ActionKind.BACKGROUND_MODEL: |
There was a problem hiding this comment.
None of VertexAI's three new Veo branches has coverage. I can delete the MODEL guard, the BACKGROUND_MODEL branch, or the CHECK_OPERATION branch and the suite stays green. The GoogleAI equivalents are all pinned: removing the MODEL guard at line 499 fails both new end-to-end tests, and the other two have test_googleai_resolve_background_model / test_googleai_resolve_check_operation.
Worth noting these branches only fire for a Veo model discovery didn't return, since init() already registers start and check for known ones and resolve_action hits the registry before plugin.resolve. That's the case they exist for, and it's untested on Vertex. Could we mirror the GoogleAI tests here?
| } | ||
|
|
||
| response = operation.response or operation.result | ||
| if response is not None and extract_video_uris(response): |
There was a problem hiding this comment.
When Veo filters a generation, the operation finishes with done: true, no error, and empty generated_videos, with the explanation in rai_media_filtered_count / rai_media_filtered_reasons. As written, this returns done=True, output=None, error=None, so the caller gets nothing to debug from.
2292e9e to
0ae2e08
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>
0ae2e08 to
4fb413f
Compare
|
Closing: Veo is already exposed only as a background model (start + check) on both GoogleAI and VertexAI on main. |
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.