# monishajaiganesh/pdf_rag_chatbot architecture

> Architecture diagram of the GitHub repository monishajaiganesh/pdf_rag_chatbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/monishajaiganesh/pdf_rag_chatbot
- Repository: https://github.com/monishajaiganesh/pdf_rag_chatbot

## Overview

PDF RAG Chatbot lets users upload PDFs, explore them conversationally, and receive answers grounded in retrieved document passages. Uploads are extracted, chunked, embedded, and indexed; questions are served through hybrid semantic and keyword retrieval, reranking, and generation with source information. The product also supports resume evaluation and document deletion. The graph includes the current frontend and the indexed legacy frontend. Some implementation details are unsampled, so those relationships are shown only where the README or excerpts support them.

Main entry points: [`api/main.py`](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/api/main.py) (FastAPI endpoints), [`vectorstore/chroma_store.py`](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/vectorstore/chroma_store.py) (Chroma persistence), [`retrieval/retriever.py`](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/retriever.py) (Hybrid retrieval), [`frontend/src/components/docmind/chat-workspace.tsx`](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend/src/components/docmind/chat-workspace.tsx) (Chat workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User experience"]
  node_workspace["Chat workspace<br/>[chat-workspace.tsx]"]
  node_frontend_api["API client<br/>[api.ts]"]
  node_legacy_ui["Legacy chat UI<br/>[App.jsx]"]
end

subgraph group_api["API and workflows"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_evaluation["Retrieval evaluation<br/>[evaluate.py]"]
end

subgraph group_ingestion["Document indexing"]
  node_pdf_files[("Local PDF files<br/>[main.py]")]
  node_chunking["PDF extraction and chunking<br/>[chunker.py]"]
  node_embedding["Embedding generation<br/>[embedding.py]"]
  node_vector_store[("Chroma persistence<br/>[chroma_store.py]")]
  node_faiss[("FAISS store<br/>[faiss_store.py]")]
end

subgraph group_retrieval["Answer retrieval"]
  node_retriever["Hybrid retrieval<br/>[retriever.py]"]
  node_reranker["Cross-encoder reranking<br/>[reranker.py]"]
  node_generation["Gemini answer generation"]
end

node_user(("User"))
node_pdf["Uploaded PDF"]
node_chroma[("Chroma index")]
node_gemini["Gemini service"]
node_ollama["Ollama service"]

node_user -->|"asks questions"| node_workspace
node_workspace -.->|"sends requests"| node_frontend_api
node_frontend_api -.->|"calls API"| node_backend
node_user -->|"uses legacy UI"| node_legacy_ui
node_legacy_ui -->|"queries API"| node_backend
node_user -->|"uploads"| node_pdf
node_pdf -->|"submits upload"| node_backend
node_backend -->|"writes and deletes"| node_pdf_files
node_backend -->|"indexes and deletes"| node_vector_store
node_vector_store -->|"creates chunks"| node_chunking
node_vector_store -->|"creates embeddings"| node_embedding
node_embedding -->|"requests vectors"| node_ollama
node_vector_store -->|"stores chunks"| node_chroma
node_backend -->|"retrieves passages"| node_retriever
node_retriever -.->|"searches vectors"| node_chroma
node_retriever -->|"reranks candidates"| node_reranker
node_backend -->|"generates answers"| node_generation
node_generation -->|"requests completion"| node_gemini
node_backend -.->|"evaluates retrieval"| node_evaluation
node_backend -->|"uses settings"| node_config
node_backend -->|"returns answer and sources"| node_user

click node_workspace "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend/src/components/docmind/chat-workspace.tsx"
click node_frontend_api "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend/src/lib/docmind/api.ts"
click node_legacy_ui "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend-old/src/App.jsx"
click node_backend "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/api/main.py"
click node_config "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/config.py"
click node_evaluation "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/evaluation/evaluate.py"
click node_pdf_files "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/api/main.py"
click node_chunking "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/ingestion/chunker.py"
click node_embedding "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/ingestion/embedding.py"
click node_vector_store "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/vectorstore/chroma_store.py"
click node_retriever "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/retriever.py"
click node_reranker "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/reranker.py"
click node_generation "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/gemini_generation.py"
click node_faiss "https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/vectorstore/faiss_store.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_workspace,node_frontend_api,node_legacy_ui,node_user toneBlue
class node_backend,node_config,node_evaluation,node_chroma toneAmber
class node_pdf_files,node_chunking,node_embedding,node_vector_store,node_faiss toneMint
class node_retriever,node_reranker,node_generation toneRose
class node_pdf,node_gemini,node_ollama toneIndigo
```

## Components

### User experience

- [Chat workspace](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend/src/components/docmind/chat-workspace.tsx): `frontend/src/components/docmind/chat-workspace.tsx`
- [API client](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend/src/lib/docmind/api.ts): `frontend/src/lib/docmind/api.ts`
- [Legacy chat UI](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/frontend-old/src/App.jsx): `frontend-old/src/App.jsx`

### API and workflows

- [FastAPI endpoints](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/api/main.py): `api/main.py`
- [Runtime configuration](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/config.py): `config.py`
- [Retrieval evaluation](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/evaluation/evaluate.py): `evaluation/evaluate.py`

### Document indexing

- [Local PDF files](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/api/main.py): `api/main.py`
- [PDF extraction and chunking](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/ingestion/chunker.py): `ingestion/chunker.py`
- [Embedding generation](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/ingestion/embedding.py): `ingestion/embedding.py`
- [Chroma persistence](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/vectorstore/chroma_store.py): `vectorstore/chroma_store.py`
- [FAISS store](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/vectorstore/faiss_store.py): `vectorstore/faiss_store.py`

### Answer retrieval

- [Hybrid retrieval](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/retriever.py): `retrieval/retriever.py`
- [Cross-encoder reranking](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/reranker.py): `retrieval/reranker.py`
- [Gemini answer generation](https://github.com/monishajaiganesh/pdf_rag_chatbot/blob/main/retrieval/gemini_generation.py): `retrieval/gemini_generation.py`

### Other components

- **User**
- **Uploaded PDF**
- **Chroma index**
- **Gemini service**
- **Ollama service**

## Connections

- User → Chat workspace: asks questions (evidence: `README.md`)
- Chat workspace → API client: sends requests
- API client → FastAPI endpoints: calls API (evidence: `README.md`)
- User → Legacy chat UI: uses legacy UI (evidence: `frontend-old/src/App.jsx`)
- Legacy chat UI → FastAPI endpoints: queries API (evidence: `frontend-old/src/App.jsx`)
- User → Uploaded PDF: uploads (evidence: `README.md`)
- Uploaded PDF → FastAPI endpoints: submits upload (evidence: `README.md`)
- FastAPI endpoints → Local PDF files: writes and deletes (evidence: `api/main.py`)
- FastAPI endpoints → Chroma persistence: indexes and deletes (evidence: `api/main.py`)
- Chroma persistence → PDF extraction and chunking: creates chunks (evidence: `vectorstore/chroma_store.py`)
- Chroma persistence → Embedding generation: creates embeddings (evidence: `vectorstore/chroma_store.py`)
- Embedding generation → Ollama service: requests vectors (evidence: `ingestion/embedding.py`)
- Chroma persistence → Chroma index: stores chunks (evidence: `vectorstore/chroma_store.py`)
- FastAPI endpoints → Hybrid retrieval: retrieves passages (evidence: `api/main.py`)
- Hybrid retrieval → Chroma index: searches vectors (evidence: `retrieval/retriever.py`)
- Hybrid retrieval → Cross-encoder reranking: reranks candidates (evidence: `retrieval/retriever.py`)
- FastAPI endpoints → Gemini answer generation: generates answers (evidence: `api/main.py`)
- Gemini answer generation → Gemini service: requests completion (evidence: `retrieval/gemini_generation.py`)
- FastAPI endpoints → Retrieval evaluation: evaluates retrieval (evidence: `README.md`)
- FastAPI endpoints → Runtime configuration: uses settings (evidence: `api/main.py`)
- FastAPI endpoints → User: returns answer and sources (evidence: `api/main.py`)
