# karthick-005/multi-url-rag-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/karthick-005/multi-url-rag-chatbot
- Repository: https://github.com/karthick-005/multi-url-rag-chatbot

## Overview

This is a single-file, in-memory multi-URL RAG chatbot. Users submit URLs through Gradio, which dispatches ingestion to fetch and clean pages, chunk text, and build a FAISS index with embeddings. Questions go through the chat handler to retrieval and context-based answer generation via the Hugging Face Router. The graph reflects calls shown in app.py and capabilities documented in README; distinct implementation stages share that source path.

Main entry points: [`app.py`](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py) (URL processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chat interface"]
  node_gradio["Gradio UI<br/>[app.py]"]
  node_chat_handler["Chat handler<br/>[app.py]"]
end

subgraph group_ingestion["URL ingestion"]
  node_process_urls["URL processing<br/>[app.py]"]
  node_document_loader["Document loader<br/>[app.py]"]
  node_text_cleaning["HTML cleaning<br/>[app.py]"]
  node_chunking["Text chunking<br/>[app.py]"]
  node_embeddings["Embeddings<br/>[app.py]"]
end

subgraph group_answering["Retrieval and answers"]
  node_faiss[("FAISS index<br/>[app.py]")]
  node_ask_question["Question answering<br/>[app.py]"]
  node_context["Context assembly<br/>[app.py]"]
  node_llm_call["LLM request<br/>[app.py]"]
end

node_user(("User"))
node_web_pages["Web pages"]
node_hf_router["Hugging Face Router"]

node_user -->|"uses"| node_gradio
node_gradio -->|"dispatches"| node_process_urls
node_process_urls -->|"loads and chunks"| node_document_loader
node_document_loader -->|"fetches"| node_web_pages
node_document_loader -->|"cleans"| node_text_cleaning
node_document_loader -->|"splits text"| node_chunking
node_process_urls -->|"uses"| node_embeddings
node_process_urls -->|"builds index"| node_faiss
node_gradio -->|"dispatches"| node_chat_handler
node_chat_handler -->|"calls"| node_ask_question
node_ask_question -->|"searches"| node_faiss
node_ask_question -->|"assembles"| node_context
node_ask_question -->|"requests answer"| node_llm_call
node_llm_call -->|"sends prompt"| node_hf_router

click node_gradio "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_process_urls "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_document_loader "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_text_cleaning "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_chunking "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_embeddings "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_faiss "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_chat_handler "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_ask_question "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_context "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py"
click node_llm_call "https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.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_gradio,node_chat_handler,node_user toneBlue
class node_process_urls,node_document_loader,node_text_cleaning,node_chunking,node_embeddings toneAmber
class node_faiss,node_ask_question,node_context,node_llm_call,node_hf_router toneMint
class node_web_pages toneIndigo
```

## Components

### Chat interface

- [Gradio UI](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [Chat handler](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`

### URL ingestion

- [URL processing](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [Document loader](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [HTML cleaning](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [Text chunking](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [Embeddings](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`

### Retrieval and answers

- [FAISS index](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [Question answering](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [Context assembly](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`
- [LLM request](https://github.com/karthick-005/multi-url-rag-chatbot/blob/main/app.py): `app.py`

### Other components

- **User**
- **Web pages**
- **Hugging Face Router**

## Connections

- User → Gradio UI: uses (evidence: `README.md`)
- Gradio UI → URL processing: dispatches (evidence: `app.py`)
- URL processing → Document loader: loads and chunks (evidence: `app.py`)
- Document loader → Web pages: fetches (evidence: `app.py`)
- Document loader → HTML cleaning: cleans (evidence: `app.py`)
- Document loader → Text chunking: splits text (evidence: `app.py`)
- URL processing → Embeddings: uses (evidence: `app.py`)
- URL processing → FAISS index: builds index (evidence: `app.py`)
- Gradio UI → Chat handler: dispatches (evidence: `app.py`)
- Chat handler → Question answering: calls (evidence: `app.py`)
- Question answering → FAISS index: searches (evidence: `app.py`)
- Question answering → Context assembly: assembles (evidence: `app.py`)
- Question answering → LLM request: requests answer (evidence: `app.py`)
- LLM request → Hugging Face Router: sends prompt (evidence: `app.py`)
