feat: BYOK cloud embedding providers (OpenAI, Voyage, Gemini)#40
Merged
feat: BYOK cloud embedding providers (OpenAI, Voyage, Gemini)#40
Conversation
- README: document cloud providers (OpenAI, Voyage, Gemini) with API key env vars, optional install extras, provider lock behaviour, updated tool signatures (index_codebase gains provider param), and updated get_index_status example showing provider/model/dims fields - CHANGELOG: add [Unreleased] entry covering BYOK cloud providers, strategy- pattern EmbeddingProvider ABC, dynamic vector dims, provider lock, live-sync guard, VectorStore meta helpers, and new test suite
16 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Type of Change
Description
Adds Bring Your Own Key (BYOK) support for cloud embedding providers, allowing users to choose between the existing local model and three cloud providers (OpenAI, Voyage AI, Google Gemini) when indexing a codebase.
Previously, VecGrep only supported a single local embedding backend. This change introduces a strategy-pattern
EmbeddingProviderabstract base class so new providers can be added by implementing a single interface. Provider selection is wired through the MCPindex_codebasetool.The vector store now persists embedding dimensionality in the per-project meta table so the LanceDB schema is created with the correct dimensions for whichever provider is in use (384 / 1024 / 1536 / 3072). A provider lock prevents silent dimension mismatches when switching providers. Re-indexing with a different provider requires
force=True.Related Issues / PRs
Changes Made
src/vecgrep/embedder.pyEmbeddingProviderABCLocalProviderOpenAIProvider,VoyageProvider,GeminiProviderwith lazy-loaded clientsget_provider(name)registryembed()free functionsrc/vecgrep/store.py_chunks_schema(dims)factory for dynamic vector sizeVectorStore.__init__to acceptdimsand read stored dims from meta_get_meta/_set_metahelpersset_provider_meta/get_provider_metadrop_and_recreate_chunks(dims)for force-switching providersget_stats()to returnprovider,model, anddimssrc/vecgrep/server.pyindex_codebasenow accepts aproviderparameter_resolve_providerenforces per-project provider lock_do_indexpasses provider dims to the store and saves provider metawatch=Trueagainst cloud providersLiveSyncHandlerskips non-local providers to prevent unbounded API usagepyproject.tomlvecgrep[openai]vecgrep[voyage]vecgrep[gemini]vecgrep[cloud]tests/test_providers.pyREADME.md/CHANGELOG.mdTesting
Manual Testing
LocalProvidertested end-to-end via existing integration testsopenai,voyageai, andgoogle-genaiclientsRuntimeErrormessagesChecklist
ruffpasses)Screenshots
N/A — CLI/MCP tool changes only.