Skip to content

feat(py): add veo 3.x googleai support#5125

Open
cabljac wants to merge 3 commits intogenkit-ai:mainfrom
invertase:feat/py-veo-3x-googleai-support
Open

feat(py): add veo 3.x googleai support#5125
cabljac wants to merge 3 commits intogenkit-ai:mainfrom
invertase:feat/py-veo-3x-googleai-support

Conversation

@cabljac
Copy link
Copy Markdown
Contributor

@cabljac cabljac commented Apr 14, 2026

Summary

  • Add Python SDK support for additional GoogleAI Veo model constants:
    • veo-3.1-generate-preview
    • veo-3.1-fast-generate-preview
    • veo-3.0-generate-001
    • veo-3.0-fast-generate-001
  • Extend Python VeoConfigSchema with newer Veo parameters used by these models (resolution, seed) while preserving existing aliases and passthrough behavior.
  • Update google-genai-media sample with dedicated Dev UI flows per Veo model:
    • generate_video_veo31
    • generate_video_veo31_fast
    • generate_video_veo30
    • generate_video_veo30_fast
    • Keep existing generic generate_video flow for model-selectable testing.

Examples

image image image image

Checklist (if applicable):

@github-actions github-actions bot added docs Improvements or additions to documentation python Python labels Apr 14, 2026
Copy link
Copy Markdown
Contributor

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

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 adds support for Google AI Veo 3.0 and 3.1 models, including new configuration fields for resolution and seed. The changes include updates to the model enums, configuration schemas, and the addition of specific video generation flows in the sample application. Review feedback suggests improving the sample code by using Pydantic model inheritance to reduce duplication, utilizing model_dump for more efficient configuration dictionary creation, and setting the default resolution to null to ensure compatibility across different model versions.

I am having trouble creating individual review comments. Click here to see my feedback.

py/samples/google-genai-media/src/main.py (144-149)

high

Instead of manually constructing the config dictionary, use model_dump(exclude_none=True) to automatically include all relevant fields while filtering out None values and redundant fields like prompt and model.

            config=input.model_dump(exclude_none=True, exclude={'prompt', 'model'}),

py/samples/google-genai-media/src/main.py (47-80)

medium

To reduce duplication and improve maintainability, VideoInput should inherit from VideoPresetInput. Additionally, the default value for resolution should be None to avoid sending it to models that might not support it (as it is a newer parameter).

class VideoPresetInput(BaseModel):
    """Input for fixed-model Veo flows in Dev UI."""

    prompt: str = Field(
        default='A paper airplane gliding through a bright classroom, cinematic slow motion',
        description='Video prompt',
    )
    aspect_ratio: str = Field(default='16:9', description='Video aspect ratio')
    duration_seconds: int = Field(default=5, description='Video duration in seconds')
    resolution: str | None = Field(default=None, description='Output resolution (for supported models)')
    seed: int | None = Field(default=None, description='Optional RNG seed')


class VideoInput(VideoPresetInput):
    """Input for Veo."""

    model: Literal[
        'googleai/veo-3.1-generate-preview',
        'googleai/veo-3.1-fast-generate-preview',
        'googleai/veo-3.0-generate-001',
        'googleai/veo-3.0-fast-generate-001',
        'googleai/veo-3.1-generate-001',
        'googleai/veo-3.1-fast-generate-001',
        'googleai/veo-2.0-generate-001',
    ] = Field(default='googleai/veo-3.1-generate-preview', description='Veo model for generation')

py/samples/google-genai-media/src/main.py (174-181)

medium

Since VideoInput now inherits from VideoPresetInput, you can pass the input object directly to the helper function instead of manually re-mapping every field.

    return await _generate_video_for_model(input, input.model)

@cabljac cabljac marked this pull request as ready for review April 14, 2026 15:39
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.

2 participants