RAG Architecture¶
Planned Architecture (Future Phases)
The RAG system is implemented in Phase 3 (Weeks 8–11). This document describes the planned design.
Overview¶
FinSight uses a hybrid retrieval strategy combining dense vector search (pgvector) and sparse keyword search (Elasticsearch) to retrieve the most relevant financial document chunks before passing them to an LLM.
Architecture Diagram¶
flowchart TD
Q[User Query] --> E[Query Encoder]
E --> VS[pgvector — Dense Search]
E --> ES[Elasticsearch — Sparse Search]
VS --> R[Reciprocal Rank Fusion]
ES --> R
R -->|Top-k chunks| P[Prompt Builder]
P --> L[LLM — GPT / Claude]
L --> A[AI Response]