# ghodeswarshreya/vjti_chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/ghodeswarshreya/vjti_chatbot
- Repository: https://github.com/ghodeswarshreya/vjti_chatbot

## Overview

VJTI AI Assistant is a document-grounded question-answering product. In the main workflow, a user asks through the React chat, which posts to the FastAPI endpoint; the backend retrieves PDF-derived chunks from FAISS, sends context to Groq for answer generation, and returns an answer with source citations for display. Separately, ingest.py builds the searchable index from the PDF collection, and ask.py offers a terminal-based querying path. The sampled files show these core relationships; other README-listed capabilities are not expanded beyond documented behavior.

Main entry points: [`backend.py`](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py) (Chat API), [`ask.py`](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/ask.py) (Terminal Chat), [`frontend/src/App.jsx`](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/frontend/src/App.jsx) (Web Chat), [`faiss_index`](https://github.com/ghodeswarshreya/vjti_chatbot/tree/main/faiss_index) (FAISS Index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_knowledge["Knowledge Preparation"]
  node_pdfs["VJTI PDFs"]
  node_ingestion["PDF Ingestion<br/>[ingest.py]"]
  node_index[("FAISS Index")]
end

subgraph group_service["Answer Service"]
  node_api["Chat API<br/>[backend.py]"]
  node_retrieval["Chunk Retrieval<br/>[backend.py]"]
  node_answering["Answer Generation<br/>[backend.py]"]
end

subgraph group_interfaces["User Interfaces"]
  node_chat["Web Chat<br/>[App.jsx]"]
  node_cli["Terminal Chat<br/>[ask.py]"]
end

node_user(("Questioner"))
node_groq["Groq Llama"]

node_user -->|"asks"| node_chat
node_chat -->|"posts question"| node_api
node_api -->|"handles query"| node_retrieval
node_retrieval -->|"searches chunks"| node_index
node_api -->|"builds context"| node_answering
node_answering -->|"requests answer"| node_groq
node_api -->|"returns answer and sources"| node_chat
node_pdfs -->|"loads documents"| node_ingestion
node_ingestion -->|"builds and saves"| node_index
node_user -->|"enters query"| node_cli
node_cli -->|"searches chunks"| node_index
node_cli -->|"requests answer"| node_groq

click node_pdfs "https://github.com/ghodeswarshreya/vjti_chatbot/tree/main/data"
click node_ingestion "https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/ingest.py"
click node_index "https://github.com/ghodeswarshreya/vjti_chatbot/tree/main/faiss_index"
click node_api "https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py"
click node_retrieval "https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py"
click node_answering "https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py"
click node_chat "https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/frontend/src/App.jsx"
click node_cli "https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/ask.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_pdfs,node_ingestion,node_index toneBlue
class node_api,node_retrieval,node_answering toneAmber
class node_chat,node_cli toneMint
class node_user,node_groq toneIndigo
```

## Components

### Knowledge Preparation

- [VJTI PDFs](https://github.com/ghodeswarshreya/vjti_chatbot/tree/main/data): `data`
- [PDF Ingestion](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/ingest.py): `ingest.py`
- [FAISS Index](https://github.com/ghodeswarshreya/vjti_chatbot/tree/main/faiss_index): `faiss_index`

### Answer Service

- [Chat API](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py): `backend.py`
- [Chunk Retrieval](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py): `backend.py`
- [Answer Generation](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/backend.py): `backend.py`

### User Interfaces

- [Web Chat](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Terminal Chat](https://github.com/ghodeswarshreya/vjti_chatbot/blob/main/ask.py): `ask.py`

### Other components

- **Questioner**
- **Groq Llama**

## Connections

- Questioner → Web Chat: asks (evidence: `frontend/src/App.jsx`)
- Web Chat → Chat API: posts question (evidence: `frontend/src/App.jsx`)
- Chat API → Chunk Retrieval: handles query (evidence: `backend.py`)
- Chunk Retrieval → FAISS Index: searches chunks (evidence: `backend.py`)
- Chat API → Answer Generation: builds context (evidence: `backend.py`)
- Answer Generation → Groq Llama: requests answer (evidence: `backend.py`)
- Chat API → Web Chat: returns answer and sources (evidence: `frontend/src/App.jsx`)
- VJTI PDFs → PDF Ingestion: loads documents (evidence: `README.md`)
- PDF Ingestion → FAISS Index: builds and saves (evidence: `ingest.py`)
- Questioner → Terminal Chat: enters query (evidence: `ask.py`)
- Terminal Chat → FAISS Index: searches chunks (evidence: `ask.py`)
- Terminal Chat → Groq Llama: requests answer (evidence: `ask.py`)
