Skip to content

feat(genai/embeddings/multimodal): Add multimodal video embedding example - #14514

Open
Kef131 wants to merge 3 commits into
mainfrom
feat(embeddings/multimodal)_add_sample_multimodal_embedding_video
Open

feat(genai/embeddings/multimodal): Add multimodal video embedding example#14514
Kef131 wants to merge 3 commits into
mainfrom
feat(embeddings/multimodal)_add_sample_multimodal_embedding_video

Conversation

@Kef131

@Kef131 Kef131 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #
b/546128007

Add new example for generating multimodal videos embeddings using the Gemini API and corresponding test.

  • Added multimodal_embedding_video.py implementing an example of embedding image and text content using the Gemini embedding model (gemini-embedding-2).
  • Changed the default GOOGLE_CLOUD_LOCATION for tests from us-central1 to global for broader compatibility.
image image

Checklist

Testing

  • I have tested this change on a live environment and verified it works as intended.

Compliance & Style


Post-Approval Actions

  • Please merge this PR for me once it is approved

@Kef131
Kef131 requested review from a team as code owners August 17, 2026 17:47
@snippet-bot

snippet-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@Kef131
Kef131 marked this pull request as draft August 17, 2026 17:47

@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 introduces a new example and test for multimodal video embedding using the gemini-embedding-2 model. The feedback highlights that changing the global GOOGLE_CLOUD_LOCATION environment variable to global can break other regional tests like model tuning; it is recommended to revert this change and use monkeypatch to set the location locally for the video embedding test. Additionally, the reviewer suggests constructing the Part object directly with file_data and video_metadata instead of mutating it after creation to ensure robustness and idiomatic code.

Comment thread genai/embeddings/test_embeddings_examples.py
Comment thread genai/embeddings/multimodal_embedding_video.py Outdated
Comment thread genai/embeddings/test_embeddings_examples.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

@angelcaamal angelcaamal 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.

LGTM!

@XrossFox XrossFox 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.

LGTM

@Kef131
Kef131 marked this pull request as ready for review August 17, 2026 22:14


def embed_content() -> types.EmbedContentResponse:
client = genai.Client()

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.

I think we need to pass the Vertex AI flags here. Since we are pointing to a gs:// bucket, the client needs to connect to Google Cloud rather than the default AI Studio backend.

Suggested change
client = genai.Client()
client = genai.Client(vertexai=True, project="YOUR_PROJECT_ID", location="us")

Here is the documentation example for reference: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/embeddings/get-multimodal-embeddings#dimensions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants