Skip to content

refactor: extract EmbeddingService interface (PR-A of #1)#2

Merged
42U merged 1 commit into
masterfrom
feat/embedding-provider-abstraction
Apr 25, 2026
Merged

refactor: extract EmbeddingService interface (PR-A of #1)#2
42U merged 1 commit into
masterfrom
feat/embedding-provider-abstraction

Conversation

@42U
Copy link
Copy Markdown
Owner

@42U 42U commented Apr 25, 2026

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.

  • EmbeddingService becomes an interface with providerId and dimensions fields
  • Current BGE-M3 implementation renamed to LocalEmbeddingService (providerId: "local-bge-m3")
  • New createEmbeddingService(config) factory at the single construction site
  • All 27+ files importing EmbeddingService as a type continue to work unchanged

No behavior change. The providerId field is groundwork for the next PR, which adds the embedding_provider column 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:

  • PR-A (this one): provider abstraction
  • PR-B: schema, provider tagging, search-time filter
  • PR-C: openai-compat provider (covers OpenAI, Azure, Together, Ollama, vLLM, etc. by baseURL)
  • PR-D: re-embed migration tool

Test plan

  • npm test — 439/439 passing
  • Typecheck shows no new errors in changed files (pre-existing peer-dep noise unchanged)
  • Manual: existing local BGE-M3 setups continue to work after this lands

Refs #1

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
@42U 42U merged commit 4c66d71 into master Apr 25, 2026
2 checks passed
@42U 42U deleted the feat/embedding-provider-abstraction branch April 25, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant