refactor: extract EmbeddingService interface (PR-A of #1)#2
Merged
Conversation
Pure refactor in preparation for #1 (configurable embedding providers). - EmbeddingService is now an interface with providerId + dimensions - Current BGE-M3 implementation renamed to LocalEmbeddingService (providerId: "local-bge-m3") - New createEmbeddingService(config) factory; future providers plug in here - Single construction site at src/index.ts switched to factory No behavior change. All 27+ call sites continue to import EmbeddingService as a type with no edits required. 439/439 tests pass. Refs #1
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.
Summary
Pure refactor in preparation for issue #1 (configurable embedding providers). Sets up the interface so a second provider can plug in without touching call sites.
EmbeddingServicebecomes an interface withproviderIdanddimensionsfieldsLocalEmbeddingService(providerId: "local-bge-m3")createEmbeddingService(config)factory at the single construction siteEmbeddingServiceas a type continue to work unchangedNo behavior change. The
providerIdfield is groundwork for the next PR, which adds theembedding_providercolumn to vector-bearing tables so two providers can never silently mix in the same HNSW index.Rollout context
This is the first of four PRs landing #1:
openai-compatprovider (covers OpenAI, Azure, Together, Ollama, vLLM, etc. bybaseURL)Test plan
npm test— 439/439 passingRefs #1