# janaeshkrish/multi-document-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/janaeshkrish/multi-document-chatbot
- Repository: https://github.com/janaeshkrish/multi-document-chatbot

## Overview

This is a Streamlit multi-document RAG chatbot. Users upload PDF, DOCX, or TXT files and explicitly process them; the app saves them, loads and chunks their contents, and builds or updates a persistent FAISS index. Users then ask questions, with chat history passed to a conversational retrieval chain that uses Gemini embeddings and a Gemini chat model to produce answers. The graph focuses on the active app path; doc_vector.py is a separate RAG demonstration. External service internals are not shown in the sampled source.

Main entry points: [`app.py`](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/app.py) (Streamlit app), [`multi_doc_chat.py`](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py) (Index processing), [`doc_loader.py`](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/doc_loader.py) (Format loaders), [`docs`](https://github.com/janaeshkrish/multi-document-chatbot/tree/main/docs) (Uploaded documents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chat interface"]
  node_app["Streamlit app<br/>[app.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_docfiles["Uploaded documents"]
  node_loader["Format loaders<br/>[doc_loader.py]"]
end

subgraph group_retrieval["Retrieval and answering"]
  node_processor["Index processing<br/>[multi_doc_chat.py]"]
  node_index[("FAISS index")]
  node_qa["Conversational QA<br/>[multi_doc_chat.py]"]
  node_demo["Standalone RAG demo<br/>[doc_vector.py]"]
end

subgraph group_integrations["External services"]
  node_embeddings["Gemini embeddings<br/>[multi_doc_chat.py]"]
  node_model["Gemini chat model<br/>[multi_doc_chat.py]"]
end

node_user(("User"))

node_user -->|"uploads and asks"| node_app
node_app -->|"saves uploads"| node_docfiles
node_app -->|"processes documents"| node_processor
node_processor -->|"loads files"| node_loader
node_loader -->|"reads files"| node_docfiles
node_processor -->|"embeds chunks"| node_embeddings
node_processor -->|"creates or updates"| node_index
node_app -->|"submits question and history"| node_qa
node_qa -->|"retrieves context"| node_index
node_qa -->|"generates answer"| node_model
node_qa -->|"retrieves embeddings"| node_embeddings
node_app -->|"displays answer"| node_user

click node_app "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/app.py"
click node_docfiles "https://github.com/janaeshkrish/multi-document-chatbot/tree/main/docs"
click node_loader "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/doc_loader.py"
click node_processor "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py"
click node_index "https://github.com/janaeshkrish/multi-document-chatbot/tree/main/faiss_index"
click node_qa "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py"
click node_embeddings "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py"
click node_model "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py"
click node_demo "https://github.com/janaeshkrish/multi-document-chatbot/blob/main/doc_vector.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_app,node_user toneBlue
class node_docfiles,node_loader toneAmber
class node_processor,node_index,node_qa,node_demo toneMint
class node_embeddings,node_model toneRose
```

## Components

### Chat interface

- [Streamlit app](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/app.py): `app.py`

### Document ingestion

- [Uploaded documents](https://github.com/janaeshkrish/multi-document-chatbot/tree/main/docs): `docs`
- [Format loaders](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/doc_loader.py): `doc_loader.py`

### Retrieval and answering

- [Index processing](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py): `multi_doc_chat.py`
- [FAISS index](https://github.com/janaeshkrish/multi-document-chatbot/tree/main/faiss_index): `faiss_index`
- [Conversational QA](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py): `multi_doc_chat.py`
- [Standalone RAG demo](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/doc_vector.py): `doc_vector.py`

### External services

- [Gemini embeddings](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py): `multi_doc_chat.py`
- [Gemini chat model](https://github.com/janaeshkrish/multi-document-chatbot/blob/main/multi_doc_chat.py): `multi_doc_chat.py`

### Other components

- **User**

## Connections

- User → Streamlit app: uploads and asks
- Streamlit app → Uploaded documents: saves uploads (evidence: `app.py`)
- Streamlit app → Index processing: processes documents (evidence: `app.py`)
- Index processing → Format loaders: loads files (evidence: `multi_doc_chat.py`)
- Format loaders → Uploaded documents: reads files (evidence: `doc_loader.py`)
- Index processing → Gemini embeddings: embeds chunks (evidence: `multi_doc_chat.py`)
- Index processing → FAISS index: creates or updates (evidence: `multi_doc_chat.py`)
- Streamlit app → Conversational QA: submits question and history (evidence: `app.py`)
- Conversational QA → FAISS index: retrieves context (evidence: `multi_doc_chat.py`)
- Conversational QA → Gemini chat model: generates answer (evidence: `multi_doc_chat.py`)
- Conversational QA → Gemini embeddings: retrieves embeddings (evidence: `multi_doc_chat.py`)
- Streamlit app → User: displays answer (evidence: `app.py`)
