@@ -8,6 +8,73 @@ A complete full-stack application for securely chatting with PDF documents using
88- ** Backend** : FastAPI (Python). Handles embedding generation, vector search, and LLM interaction.
99- ** Infrastructure** : Docker & Docker Compose for easy deployment.
1010
11+ ### System Diagram
12+
13+ ``` mermaid
14+ graph TD
15+ User([User])
16+ subgraph "Frontend (React + Vite)"
17+ UI[Browser UI]
18+ State[Local State]
19+ end
20+ subgraph "Backend (FastAPI)"
21+ API[API Endpoints]
22+ subgraph "Ingestion"
23+ PDF[PDF Loader]
24+ Split[Text Splitter]
25+ end
26+ subgraph "Vector Store"
27+ VS[(FAISS Index)]
28+ JSON[(JSON Chunks)]
29+ end
30+ LLM[Gemini Pro API]
31+ end
32+
33+ User <--> UI
34+ UI <--> State
35+ State <--> API
36+ API --> PDF
37+ PDF --> Split
38+ Split --> LLM
39+ LLM --> VS
40+ API --> VS
41+ VS --> JSON
42+ JSON --> LLM
43+ LLM --> API
44+ ```
45+
46+ ### RAG Workflow
47+
48+ ``` mermaid
49+ sequenceDiagram
50+ participant User
51+ participant Frontend
52+ participant Backend
53+ participant FAISS
54+ participant Gemini
55+
56+ Note over User, Gemini: Document Ingestion
57+ User->>Frontend: Upload PDF
58+ Frontend->>Backend: POST /upload
59+ Backend->>Backend: Extract & Split Text
60+ Backend->>Gemini: Generate Embeddings
61+ Gemini-->>Backend: Vector Data
62+ Backend->>FAISS: Save Index & Chunks
63+ Backend-->>Frontend: Ready (200 OK)
64+
65+ Note over User, Gemini: Retrieval-Augmented Generation
66+ User->>Frontend: Ask Question
67+ Frontend->>Backend: POST /ask
68+ Backend->>Gemini: Embed Question
69+ Gemini-->>Backend: Query Vector
70+ Backend->>FAISS: Similarity Search
71+ FAISS-->>Backend: Context Chunks
72+ Backend->>Gemini: Context + Question
73+ Gemini-->>Backend: Generated Answer
74+ Backend-->>Frontend: Answer
75+ Frontend-->>User: Display Response
76+ ```
77+
1178## Quick Start (Docker)
1279
1380The easiest way to run the entire system is with Docker Compose.
0 commit comments