# sundaranbu18/genai-course architecture

> Architecture diagram of the GitHub repository sundaranbu18/genai-course, 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/sundaranbu18/genai-course
- Repository: https://github.com/sundaranbu18/genai-course

## Overview

This repository combines Python teaching materials with two smaller RAG examples and a deployed Django RAG chatbot. In ragbot, users ask questions through the chat interface or embedded widget; Django routes requests to the RAG pipeline, which retrieves passages from a locally indexed document collection and asks Claude to answer from that context. The pipeline also supports conversation history. The graph includes the assignment RAG and single-file personal RAG as separate products. Some links rely on the README or SOURCE INDEX because their implementation excerpts were not provided.

Main entry points: [`ragbot/ragcore/pipeline.py`](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/pipeline.py) (RAG pipeline), [`ragbot/chatbot/views.py`](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/views.py) (Django chat API), [`ragbot/ragcore/indexing.py`](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/indexing.py) (Index builder), [`ragbot/ragcore/store.py`](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/store.py) (FAISS retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Chat interface"]
  node_widget["Embedded widget<br/>[widget.js]"]
  node_django["Django chat API<br/>[views.py]"]
  node_routes["Chat routes<br/>[urls.py]"]
end

subgraph group_rag["RAG runtime"]
  node_pipeline["RAG pipeline<br/>[pipeline.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
  node_embedder["Text embeddings<br/>[embeddings.py]"]
  node_retrieval[("FAISS retrieval<br/>[store.py]")]
  node_generator["Answer generation<br/>[generator.py]"]
  node_history[("Conversation history<br/>[history.py]")]
end

subgraph group_indexing["Document indexing"]
  node_indexing["Index builder<br/>[indexing.py]"]
  node_chunking["Document chunking<br/>[chunking.py]"]
  node_cli["RAG CLI<br/>[cli.py]"]
end

subgraph group_examples["RAG examples"]
  node_assignment_ui["Assignment API<br/>[app.py]"]
  node_assignment_chain["Assignment answer chain<br/>[chain.py]"]
  node_assignment_store[("Assignment vector store<br/>[store.py]")]
  node_assignment_ingest["PDF ingestion<br/>[ingest.py]"]
  node_assignment_questions["Evaluation questions<br/>[questions.py]"]
  node_personal["Personal notes RAG<br/>[personal_rag.py]"]
end

subgraph group_learning["Learning materials"]
  node_course["Python course exercises"]
end

node_user(("Chat user"))
node_claude{{"Anthropic Claude"}}
node_anthropic{{"Anthropic API"}}

node_user -->|"asks question"| node_django
node_widget -->|"calls JSON API"| node_django
node_routes -->|"routes requests"| node_django
node_django -->|"requests answer"| node_pipeline
node_pipeline -->|"loads settings"| node_settings
node_pipeline -->|"loads and records turns"| node_history
node_pipeline -->|"searches passages"| node_retrieval
node_pipeline -->|"generates answer"| node_generator
node_retrieval -->|"embeds query"| node_embedder
node_generator -->|"requests completion"| node_anthropic
node_cli -->|"builds index"| node_indexing
node_cli -->|"answers questions"| node_pipeline
node_indexing -->|"chunks documents"| node_chunking
node_indexing -->|"writes index"| node_retrieval
node_assignment_ui -->|"builds store"| node_assignment_store
node_assignment_ui -->|"requests answer"| node_assignment_chain
node_assignment_chain -->|"retrieves passages"| node_assignment_store
node_assignment_store -->|"loads chunks"| node_assignment_ingest
node_personal -.->|"answers questions"| node_user
node_assignment_questions -.->|"evaluates answers"| node_assignment_chain

click node_widget "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/static/chatbot/widget.js"
click node_django "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/views.py"
click node_routes "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/urls.py"
click node_pipeline "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/pipeline.py"
click node_settings "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/config.py"
click node_embedder "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/embeddings.py"
click node_retrieval "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/store.py"
click node_generator "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/generator.py"
click node_history "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/history.py"
click node_indexing "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/indexing.py"
click node_chunking "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/chunking.py"
click node_cli "https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/cli.py"
click node_assignment_ui "https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/app.py"
click node_assignment_chain "https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/rag/chain.py"
click node_assignment_store "https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/rag/store.py"
click node_assignment_ingest "https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/rag/ingest.py"
click node_assignment_questions "https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/evaluation/questions.py"
click node_personal "https://github.com/sundaranbu18/genai-course/blob/main/personal_rag/personal_rag.py"
click node_course "https://github.com/sundaranbu18/genai-course/tree/main/course"

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_widget,node_django,node_routes,node_user toneBlue
class node_pipeline,node_settings,node_embedder,node_retrieval,node_generator,node_history toneAmber
class node_indexing,node_chunking,node_cli,node_anthropic toneMint
class node_assignment_ui,node_assignment_chain,node_assignment_store,node_assignment_ingest,node_assignment_questions,node_personal toneRose
class node_course,node_claude toneIndigo
```

## Components

### Chat interface

- [Embedded widget](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/static/chatbot/widget.js): `ragbot/chatbot/static/chatbot/widget.js`
- [Django chat API](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/views.py): `ragbot/chatbot/views.py`
- [Chat routes](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/chatbot/urls.py): `ragbot/chatbot/urls.py`

### RAG runtime

- [RAG pipeline](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/pipeline.py): `ragbot/ragcore/pipeline.py`
- [Runtime settings](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/config.py): `ragbot/ragcore/config.py`
- [Text embeddings](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/embeddings.py): `ragbot/ragcore/embeddings.py`
- [FAISS retrieval](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/store.py): `ragbot/ragcore/store.py`
- [Answer generation](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/generator.py): `ragbot/ragcore/generator.py`
- [Conversation history](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/history.py): `ragbot/ragcore/history.py`

### Document indexing

- [Index builder](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/indexing.py): `ragbot/ragcore/indexing.py`
- [Document chunking](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/chunking.py): `ragbot/ragcore/chunking.py`
- [RAG CLI](https://github.com/sundaranbu18/genai-course/blob/main/ragbot/ragcore/cli.py): `ragbot/ragcore/cli.py`

### RAG examples

- [Assignment API](https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/app.py): `rag_assisment/app.py`
- [Assignment answer chain](https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/rag/chain.py): `rag_assisment/rag/chain.py`
- [Assignment vector store](https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/rag/store.py): `rag_assisment/rag/store.py`
- [PDF ingestion](https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/rag/ingest.py): `rag_assisment/rag/ingest.py`
- [Evaluation questions](https://github.com/sundaranbu18/genai-course/blob/main/rag_assisment/evaluation/questions.py): `rag_assisment/evaluation/questions.py`
- [Personal notes RAG](https://github.com/sundaranbu18/genai-course/blob/main/personal_rag/personal_rag.py): `personal_rag/personal_rag.py`

### Learning materials

- [Python course exercises](https://github.com/sundaranbu18/genai-course/tree/main/course): `course`

### Other components

- **Chat user**
- **Anthropic Claude**
- **Anthropic API**

## Connections

- Chat user → Django chat API: asks question
- Embedded widget → Django chat API: calls JSON API
- Chat routes → Django chat API: routes requests (evidence: `ragbot/chatbot/urls.py`)
- Django chat API → RAG pipeline: requests answer (evidence: `ragbot/chatbot/views.py`)
- RAG pipeline → Runtime settings: loads settings (evidence: `ragbot/ragcore/pipeline.py`)
- RAG pipeline → Conversation history: loads and records turns (evidence: `ragbot/ragcore/pipeline.py`)
- RAG pipeline → FAISS retrieval: searches passages (evidence: `ragbot/ragcore/pipeline.py`)
- RAG pipeline → Answer generation: generates answer (evidence: `ragbot/ragcore/pipeline.py`)
- FAISS retrieval → Text embeddings: embeds query (evidence: `ragbot/ragcore/store.py`)
- Answer generation → Anthropic API: requests completion (evidence: `ragbot/ragcore/generator.py`)
- RAG CLI → Index builder: builds index (evidence: `ragbot/ragcore/cli.py`)
- RAG CLI → RAG pipeline: answers questions (evidence: `ragbot/ragcore/cli.py`)
- Index builder → Document chunking: chunks documents (evidence: `ragbot/ragcore/indexing.py`)
- Index builder → FAISS retrieval: writes index (evidence: `ragbot/ragcore/indexing.py`)
- Assignment API → Assignment vector store: builds store (evidence: `rag_assisment/app.py`)
- Assignment API → Assignment answer chain: requests answer (evidence: `rag_assisment/app.py`)
- Assignment answer chain → Assignment vector store: retrieves passages (evidence: `rag_assisment/rag/chain.py`)
- Assignment vector store → PDF ingestion: loads chunks (evidence: `rag_assisment/rag/store.py`)
- Personal notes RAG → Chat user: answers questions
- Evaluation questions → Assignment answer chain: evaluates answers (evidence: `rag_assisment/assigment.py`)
