Refactor: Rag as a service #62
Draft
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.
Migrate RAG to Dedicated Microservice with PostgreSQL Storage
Summary
Migrates RAG from PVC-based storage to a dedicated RAG microservice using PostgreSQL for embedding storage. This removes ReadWriteOnce constraints, reduces memory duplication, and simplifies the architecture.
Changes
services/rag/): FastAPI service that loads embeddings from PostgreSQL and serves queries via HTTPragembeddingtable usingpgvectorextensionRAGHandlernow communicates with RAG service via HTTP instead of loading local FAISS indexinit_pipeline.pysaves embeddings to PostgreSQL and waits for RAG service readinessBenefits
Architecture
The init job and RAG service start in parallel; the RAG service polls PostgreSQL until embeddings are available, then loads the index and becomes ready.
Testing
Migration Notes