# disha4346/rag_ai_assisstant architecture

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

- Interactive diagram: https://gitdiagram.com/disha4346/rag_ai_assisstant
- Repository: https://github.com/disha4346/rag_ai_assisstant

## Overview

This is a browser-based conversational question-answering app grounded in a configured PDF. A user submits a question through the frontend; the backend runs a retrieval-augmented generation chain, returns an answer, and saves the exchange in conversation memory. On startup, the backend loads an existing FAISS index or builds one from the PDF. The README is empty, so documented capabilities beyond the sampled source cannot be assessed; loader, embedder, and memory internals were not sampled.

Main entry points: [`backend/main.py`](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/main.py) (RAG setup), [`backend/src/pipeline/rag_pipeline.py`](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/pipeline/rag_pipeline.py) (Conversational RAG), [`backend/app.py`](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/app.py) (Chat API), [`frontend/static/script.js`](https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/static/script.js) (Chat client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_web["Web page server<br/>[app.py]"]
  node_page["Chat page<br/>[index.html]"]
  node_browser["Chat client<br/>[script.js]"]
end

subgraph group_backend["Backend orchestration"]
  node_backend_app["Chat API<br/>[app.py]"]
  node_orchestrator["RAG setup<br/>[main.py]"]
end

subgraph group_ingestion["Document indexing"]
  node_pdf["Configured PDF<br/>[2604.12062v1.pdf]"]
  node_loader["Document loader<br/>[loader.py]"]
  node_preprocess["Text preprocessing<br/>[preprocess.py]"]
  node_chunker["Text chunking<br/>[chunker.py]"]
  node_embedder["Embedding provider<br/>[embedder.py]"]
  node_vectorstore[("FAISS vector store<br/>[vectordb.py]")]
end

subgraph group_answering["Retrieval and answering"]
  node_retriever["MMR retriever<br/>[retriever.py]"]
  node_pipeline["Conversational RAG<br/>[rag_pipeline.py]"]
  node_reranker["Document reranker<br/>[reranker.py]"]
  node_memory["Conversation memory<br/>[memory.py]"]
  node_llm["LLM client<br/>[llm.py]"]
end

node_user(("User"))
node_groq["Groq service"]

node_user -->|"opens page"| node_web
node_web -->|"renders"| node_page
node_page -->|"loads client"| node_browser
node_user -->|"submits question"| node_browser
node_browser -->|"POST chat/reset"| node_backend_app
node_backend_app -->|"initializes RAG"| node_orchestrator
node_orchestrator -->|"gets embeddings"| node_embedder
node_orchestrator -->|"loads or builds"| node_vectorstore
node_orchestrator -->|"loads PDF"| node_loader
node_pdf -->|"document input"| node_loader
node_orchestrator -->|"cleans documents"| node_preprocess
node_orchestrator -->|"splits documents"| node_chunker
node_orchestrator -->|"creates retriever"| node_retriever
node_orchestrator -->|"creates client"| node_llm
node_orchestrator -->|"creates memory"| node_memory
node_orchestrator -->|"builds chain"| node_pipeline
node_loader -->|"documents"| node_preprocess
node_preprocess -->|"cleaned documents"| node_chunker
node_chunker -->|"chunks"| node_vectorstore
node_embedder -->|"embeddings"| node_vectorstore
node_vectorstore -->|"searches index"| node_retriever
node_backend_app -->|"invokes chain"| node_pipeline
node_pipeline -->|"searches query"| node_retriever
node_pipeline -->|"reranks results"| node_reranker
node_pipeline -->|"loads history"| node_memory
node_pipeline -->|"sends prompt"| node_llm
node_llm -->|"requests completion"| node_groq
node_backend_app -->|"saves or clears"| node_memory
node_backend_app -->|"returns response"| node_browser

click node_web "https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/app.py"
click node_page "https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/templates/index.html"
click node_browser "https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/static/script.js"
click node_backend_app "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/app.py"
click node_orchestrator "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/main.py"
click node_pdf "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/data/2604.12062v1.pdf"
click node_loader "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/loaders/loader.py"
click node_preprocess "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/preprocessing/preprocess.py"
click node_chunker "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/chunking/chunker.py"
click node_embedder "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/embeddings/embedder.py"
click node_vectorstore "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/vectorstore/vectordb.py"
click node_retriever "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/retriever/retriever.py"
click node_pipeline "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/pipeline/rag_pipeline.py"
click node_reranker "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/reranker/reranker.py"
click node_memory "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/memory/memory.py"
click node_llm "https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/llm/llm.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_web,node_page,node_browser,node_user toneBlue
class node_backend_app,node_orchestrator toneAmber
class node_pdf,node_loader,node_preprocess,node_chunker,node_embedder,node_vectorstore toneMint
class node_retriever,node_pipeline,node_reranker,node_memory,node_llm toneRose
class node_groq toneIndigo
```

## Components

### Web interface

- [Web page server](https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/app.py): `frontend/app.py`
- [Chat page](https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/templates/index.html): `frontend/templates/index.html`
- [Chat client](https://github.com/disha4346/rag_ai_assisstant/blob/main/frontend/static/script.js): `frontend/static/script.js`

### Backend orchestration

- [Chat API](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/app.py): `backend/app.py`
- [RAG setup](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/main.py): `backend/main.py`

### Document indexing

- [Configured PDF](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/data/2604.12062v1.pdf): `backend/data/2604.12062v1.pdf`
- [Document loader](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/loaders/loader.py): `backend/src/loaders/loader.py`
- [Text preprocessing](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/preprocessing/preprocess.py): `backend/src/preprocessing/preprocess.py`
- [Text chunking](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/chunking/chunker.py): `backend/src/chunking/chunker.py`
- [Embedding provider](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/embeddings/embedder.py): `backend/src/embeddings/embedder.py`
- [FAISS vector store](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/vectorstore/vectordb.py): `backend/src/vectorstore/vectordb.py`

### Retrieval and answering

- [MMR retriever](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/retriever/retriever.py): `backend/src/retriever/retriever.py`
- [Conversational RAG](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/pipeline/rag_pipeline.py): `backend/src/pipeline/rag_pipeline.py`
- [Document reranker](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/reranker/reranker.py): `backend/src/reranker/reranker.py`
- [Conversation memory](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/memory/memory.py): `backend/src/memory/memory.py`
- [LLM client](https://github.com/disha4346/rag_ai_assisstant/blob/main/backend/src/llm/llm.py): `backend/src/llm/llm.py`

### Other components

- **User**
- **Groq service**

## Connections

- User → Web page server: opens page
- Web page server → Chat page: renders
- Chat page → Chat client: loads client
- User → Chat client: submits question
- Chat client → Chat API: POST chat/reset
- Chat API → RAG setup: initializes RAG
- RAG setup → Embedding provider: gets embeddings
- RAG setup → FAISS vector store: loads or builds
- RAG setup → Document loader: loads PDF
- Configured PDF → Document loader: document input
- RAG setup → Text preprocessing: cleans documents
- RAG setup → Text chunking: splits documents
- RAG setup → MMR retriever: creates retriever
- RAG setup → LLM client: creates client
- RAG setup → Conversation memory: creates memory
- RAG setup → Conversational RAG: builds chain
- Document loader → Text preprocessing: documents
- Text preprocessing → Text chunking: cleaned documents
- Text chunking → FAISS vector store: chunks
- Embedding provider → FAISS vector store: embeddings
- FAISS vector store → MMR retriever: searches index
- Chat API → Conversational RAG: invokes chain
- Conversational RAG → MMR retriever: searches query
- Conversational RAG → Document reranker: reranks results
- Conversational RAG → Conversation memory: loads history
- Conversational RAG → LLM client: sends prompt
- LLM client → Groq service: requests completion
- Chat API → Conversation memory: saves or clears
- Chat API → Chat client: returns response
