Skip to content

Centralize Vertex AI API Version Configuration #913

@ghchinoy

Description

@ghchinoy

Description:
Currently, the Vertex AI API version (e.g., v1beta1) is either hardcoded or relying on the SDK default across multiple model files (models/veo.py, models/image_models.py, etc.).

We should centralize this configuration to ensure consistency and make upgrades easier for users that want to explicitly set a version (v1beta1, v1, etc.).

Proposed Changes:

  1. Update config/default.py:
    Add a new configuration variable to the Default class:

    VERTEX_API_VERSION: str = os.environ.get("VERTEX_API_VERSION", "v1beta1")
  2. Refactor Model Clients:
    Update all genai.Client instantiations to use this config value.

    client = genai.Client(
        # ...
        http_options={'api_version': config.VERTEX_API_VERSION}
    )

Affected Files:

  • config/default.py
  • models/image_models.py
  • models/veo.py
  • models/vto.py
  • models/upscale.py
  • models/character_consistency.py
  • models/model_setup.py

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgood first issueGood for newcomerspythonPull requests that update python code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions