feat(genai/embeddings): migrate code retrieval and model tuning examples to genai - #14475
feat(genai/embeddings): migrate code retrieval and model tuning examples to genai#14475XrossFox wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new example script, code_retrieval_example.py, demonstrating how to use the Google GenAI SDK for code retrieval embeddings. The feedback highlights a few areas for improvement: correcting the return type annotation of the embed_test function to return response objects instead of config objects, removing an unused and unsupported DIMENSIONALITY constant, and ensuring consistent usage of the imported types module instead of referencing genai.types directly.
implementation of embedded model tuning. - Added missing python doc. - Updated requirements files.
- created tests for migrated samples.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces two new embedding examples: code_retrieval_example.py for indexing and searching source code using the Gemini API, and model_tuning_example.py for tuning text embedding models via Vertex AI Pipelines. It also updates dependencies and adds corresponding unit tests. Feedback highlights several improvement opportunities, including mocking the Vertex AI Pipeline job in tests to prevent executing expensive live jobs, removing unused constants in both example files, correcting an incorrect return type hint in the code retrieval example, and fixing a typo in a test function name.
Description
This PR migrates and introduces new code examples for Vertex AI and GenAI embeddings.
Changes:
model_tuning_example.pyto demonstrate text embedding model tuning using Vertex AI pipelines (aiplatform).code_retrieval_example.pyto demonstrate source code indexing and code retrieval queries using thegoogle-genaiSDK.test_embeddings_examples.py.requirements.txtandrequirements-test.txt(bumpedgoogle-genai,pytest,google-api-core, and addedgoogle-cloud-aiplatform).Fixes b/540948638
Checklist
Testing
Compliance & Style
Post-Approval Actions