How the-full-stack/ask-fsdl works
Purpose and Entry Points
askFSDL is a retrieval-augmented Q&A system over Full Stack Deep Learning educational content and an LLM literature review. It exposes two user-facing frontends: a Gradio application in app.py and a Discord interactions bot in bot.py. Both invoke a shared retrieval-and-generation backend pattern.
Query Orchestration and Prompting
app.py and bot.py accept user questions, retrieve relevant corpus passages, assemble an LLM prompt, and return an answer. Prompt templates and response instructions are centralized in prompts.py; shared application utilities are in utils.py. LangChain organizes LLM invocation and prompt composition.
Persistent Document Corpus
Cleaned, structured source documents are persisted in MongoDB Atlas through docstore.py. MongoDB is the durable corpus boundary: ETL writes normalized records there, while retrieval/index-refresh processes read from it. Setup guidance and service-specific provisioning live under setup/mongodb and setup/SETUP.md.
Vector Retrieval Layer
vecstore.py manages the FAISS vector index used for fast semantic retrieval. This is the low-latency search boundary between a user query and the document corpus: query embeddings are matched against indexed document chunks, then selected context is supplied to the LLM. The vector index is refreshed as corpus ETL changes.
Corpus ETL Pipeline
The ETL modules extract and normalize distinct source formats: Markdown in etl/markdown.py, PDFs in etl/pdfs.py, and video-derived content in etl/videos.py. Shared chunking, metadata, and persistence behavior belongs in etl/shared.py. The notebook Running ETL to Build the Document Corpus.ipynb documents execution of the broader corpus-build workflow.
Source Data and Batch Execution
Repository data inputs include course lectures, videos, and paper metadata under data/lectures-2022.json, data/videos.json, and data/llm-papers.json. Batch ETL is launched via tasks/run_etl.sh; it writes corpus records and supports rebuilding the FAISS search materialization rather than serving requests directly.
Runtime, Deployment, and External Services
Python is the primary runtime, with dependencies declared in pyproject.toml and requirements.txt. Modal provides serverless hosting for the backend, Discord bot, and batch work; deployment scripts include tasks/run_backend_modal.sh and tasks/run_frontend_modal.sh. OpenAI provides model/API calls, MongoDB Atlas stores documents, FAISS provides local/vector similarity search, Discord provides the bot interaction endpoint, Gradio provides the lightweight UI, and Gantry monitors production model behavior and user feedback.
Main entry points: run_etl.sh ETL batch launcher · shared.py Normalization and chunking · bot.py Discord bot · markdown.py Markdown ETL
Components 20
User interfaces
- Gradio app
app.py - Discord bot
bot.py
Retrieval and generation
- RAG orchestration · Retrieves context, builds a prompt, and returns answers.
- Prompt templates
prompts.py - Shared utilities
utils.py - LangChain
- FAISS index · Low-latency semantic search over indexed document chunks.
vecstore.py
Corpus build pipeline
- ETL batch launcher
tasks/run_etl.sh - Lecture data
data/lectures-2022.json - Video data
data/videos.json - Paper metadata
data/llm-papers.json - Markdown ETL
etl/markdown.py - PDF ETL
etl/pdfs.py - Video ETL
etl/videos.py - Normalization and chunking · Applies shared metadata, chunking, and persistence behavior.
etl/shared.py
External services
- Discord
- OpenAI
- Gantry · Monitors production behavior and user feedback.
- MongoDB Atlas · Durable store for cleaned, structured source documents.
docstore.py - Modal · Hosts application, bot, and batch workloads.
Connections 23
- Discord → Discord bot: delivers interactions
- Gradio app → RAG orchestration: questions
- Discord bot → RAG orchestration: questions
- Shared utilities → RAG orchestration: supports
- Prompt templates → RAG orchestration: instructions
- RAG orchestration → LangChain: composes invocation
- RAG orchestration → FAISS index: retrieves context
- LangChain → OpenAI: model calls
- RAG orchestration → Gantry: telemetry and feedback
- Lecture data → Markdown ETL: course content
- Paper metadata → PDF ETL: paper sources
- Video data → Video ETL: video sources
- Markdown ETL → Normalization and chunking: normalized content
- PDF ETL → Normalization and chunking: normalized content
- Video ETL → Normalization and chunking: normalized content
- Normalization and chunking → MongoDB Atlas: persists records
- ETL batch launcher → Markdown ETL: runs
- ETL batch launcher → PDF ETL: runs
- ETL batch launcher → Video ETL: runs
- MongoDB Atlas → FAISS index: corpus refresh
- Modal → Gradio app: hosts
- Modal → Discord bot: hosts
- Modal → ETL batch launcher: runs batch work