fix(tests): Uses gemini-embedding-001 by default#2306
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where certain functional tests were being skipped by updating the default embedding model used in the test suite. By switching the default to Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the default embedding model for tests from OpenAI's text-embedding-3-small to gemini/gemini-embedding-001. This change also enables a previously skipped functional test for real embeddings, which is a good improvement. I've added one suggestion in conftest.py to improve maintainability by avoiding code duplication.
| return EmbeddingModel( | ||
| model=os.getenv("TEST_EMBEDDING_MODEL", "text-embedding-3-small"), | ||
| model=os.getenv("TEST_EMBEDDING_MODEL", "gemini/gemini-embedding-001"), | ||
| params=EmbeddingParams(dimensions=1536), | ||
| ) |
There was a problem hiding this comment.
To improve maintainability and avoid duplicating the default model name, we can refactor this fixture. The default model gemini/gemini-embedding-001 is already specified in the LitellmEmbeddingModel definition. By conditionally adding the model argument only when the TEST_EMBEDDING_MODEL environment variable is set, we can rely on the default defined in the model class and have a single source of truth for the default model.
| return EmbeddingModel( | |
| model=os.getenv("TEST_EMBEDDING_MODEL", "text-embedding-3-small"), | |
| model=os.getenv("TEST_EMBEDDING_MODEL", "gemini/gemini-embedding-001"), | |
| params=EmbeddingParams(dimensions=1536), | |
| ) | |
| model_name = os.getenv("TEST_EMBEDDING_MODEL") | |
| init_kwargs = {"params": EmbeddingParams(dimensions=1536)} | |
| if model_name: | |
| init_kwargs["model"] = model_name | |
| return EmbeddingModel(**init_kwargs) |
Description
Fix skipped tests by using gemini model by default
Related Issue
Fixes #2305
Type of Change