LearnNewsExamplesServices
Frontmatter
id7904
titleRefactor Knowledge Base embedding logic into Vector Service
stateClosed
labels
airefactoring
assigneestobiu
createdAtNov 25, 2025, 5:19 PM
updatedAtNov 25, 2025, 6:29 PM
githubUrlhttps://github.com/neomjs/neo/issues/7904
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 25, 2025, 6:29 PM

Refactor Knowledge Base embedding logic into Vector Service

Closed v11.11.0 airefactoring
tobiu
tobiu commented on Nov 25, 2025, 5:19 PM

Goal: Further simplify DatabaseService.mjs by extracting the embedding generation and vector database upsert logic into a dedicated service.

Current State: embedKnowledgeBase is a complex method (~160 lines) that mixes:

  1. Business Logic: Calculating class inheritance chains, hashing chunks, and diffing against the existing database.
  2. Integration Logic: Interacting with the Google Generative AI API for embeddings and the ChromaDB client for storage.

Proposed Architecture:

  • Create a new service (e.g., services/VectorService.mjs or services/EmbeddingService.mjs).
  • Move the heavy lifting of the "ETL Load" phase to this service.

Impact: DatabaseService will become a pure lifecycle manager and orchestrator, delegating:

  • Extraction to source/* providers.
  • Loading/Embedding to the new VectorService. This completes the separation of concerns for the Knowledge Base.
tobiu added the ai label on Nov 25, 2025, 5:19 PM
tobiu added the refactoring label on Nov 25, 2025, 5:19 PM
tobiu assigned to @tobiu on Nov 25, 2025, 6:28 PM
tobiu referenced in commit 227b7ae - "Refactor Knowledge Base embedding logic into Vector Service #7904" on Nov 25, 2025, 6:29 PM
tobiu closed this issue on Nov 25, 2025, 6:29 PM