feat(genai/embeddings/multimodal): Add multimodal video embedding example - #14514
feat(genai/embeddings/multimodal): Add multimodal video embedding example#14514Kef131 wants to merge 3 commits into
Conversation
…ation to use global location
|
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated by snippet-bot.
|
There was a problem hiding this comment.
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.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…rm_genai_multimodal_embedding_video
|
|
||
|
|
||
| def embed_content() -> types.EmbedContentResponse: | ||
| client = genai.Client() |
There was a problem hiding this comment.
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.
| 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
Description
Fixes #
b/546128007
Add new example for generating multimodal videos embeddings using the Gemini API and corresponding test.
multimodal_embedding_video.pyimplementing an example of embedding image and text content using the Gemini embedding model (gemini-embedding-2).GOOGLE_CLOUD_LOCATIONfor tests fromus-central1toglobalfor broader compatibility.Checklist
Testing
Compliance & Style
Post-Approval Actions