feat(ingestion): add document registry and local ingestion backbone#33
Merged
feat(ingestion): add document registry and local ingestion backbone#33
Conversation
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.
This pull request introduces several significant improvements and additions to the backend, focusing on document ingestion, embedding infrastructure, and codebase modernization. The highlights include a major database migration for tracking document ingestion jobs, the addition of a Node.js embedding runtime, and refactoring to unify import paths and configuration management. Below are the most important changes grouped by theme:
Database and Ingestion Infrastructure:
0002_ingestion_registry.py) that expands thedocumentsanddocument_chunkstables with new columns (e.g.,parser_id,chunker_id,embedding_model_id,chunk_count, error fields) and introduces a newingestion_jobstable to track document ingestion attempts and statuses. This migration also adds relevant constraints and indexes for data integrity and performance.paperchat.db.schemapath instead of the previouspaperchat_backend.db.schema, ensuring consistency with the refactored package structure. [1] [2] [3] [4]Embedding Runtime and Configuration:
embedder.mjs) that uses thenode-llama-cpplibrary to generate text embeddings, along with its ownpackage.jsonfor dependency management. This enables efficient, language-agnostic embedding generation. [1] [2]config.pyto include embedding model and cache directory settings, with new helper functions for retrieving embedding model names and cache locations, supporting environment variable overrides. [1] [2]API and Service Layer:
api/documents.py), providing endpoints for importing, listing, retrieving, retrying, and deleting documents, and exposing ingestion job status to clients.paperchat.models,paperchat.services, etc.), removing legacy references topaperchat_backend. [1] [2] [3] [4] [5] [6] [7]Developer Experience and CI:
ruffhooks to use theuvrunner directly and refining file matching patterns for better accuracy.pnpm(10.30.3) for more reproducible builds. (.github/workflows/ci.yml)Database Session Management:
get_session_factory()function todb/engine.pyto provide a reusable SQLAlchemy session factory, simplifying session management across the backend.These changes collectively improve the backend's scalability, maintainability, and extensibility, particularly around document ingestion and embedding workflows.