How leosumanth3-source/swarnasky-chatbot works
This repository builds a website-grounded RAG assistant: it archives Swarnasky pages, cleans and sections their content, chunks and indexes it, then serves answers through a FastAPI chat endpoint. The main API performs embedding, Qdrant retrieval, reranking, context assembly, and Ollama generation; separate command-line scripts demonstrate retrieval and RAG flows. Pipeline links are supported by the scripts’ documented input/output formats. The README is empty, so API capabilities beyond the sampled excerpts are not inferred.
Main entry points: main.py Chat API · rag.py CLI RAG flow · reranker.py Rerank utility · embed_to_qdrant.py Vector indexer
Components 18
Content ingestion
- Website crawler
crawl.py - Content cleaner
clean_data.py - Section chunker
chunks.py - Vector indexer
embed_to_qdrant.py
Answer service
- Chat API
main.py - Query embedding
main.py - Candidate retrieval
main.py - Result reranking
main.py - Context answer
main.py
Retrieval utilities
- CLI RAG flow
rag.py - Search utility
search.py - Rerank utility
reranker.py
Models and storage
- Embedding model
- Cross-encoder
- Qdrant collection
- Ollama model
Other components
- Website visitor
- Swarnasky website
Connections 25
- Website crawler → Swarnasky website: fetches pages
crawl.py - Website crawler → Content cleaner: archives HTML
- Content cleaner → Section chunker: writes cleaned sections
chunks.py - Section chunker → Vector indexer: writes chunk records
embed_to_qdrant.py - Vector indexer → Embedding model: embeds chunks
embed_to_qdrant.py - Vector indexer → Qdrant collection: upserts vectors
embed_to_qdrant.py - Website visitor → Chat API: asks question
- Chat API → Query embedding: handles request
main.py - Query embedding → Embedding model: embeds question
main.py - Chat API → Candidate retrieval: runs retrieval
main.py - Candidate retrieval → Qdrant collection: queries vectors
main.py - Chat API → Result reranking: ranks candidates
main.py - Result reranking → Cross-encoder: scores documents
main.py - Chat API → Context answer: builds response
main.py - Context answer → Ollama model: generates answer
main.py - Website visitor → CLI RAG flow: asks question
rag.py - CLI RAG flow → Embedding model: embeds question
rag.py - CLI RAG flow → Qdrant collection: retrieves candidates
rag.py - CLI RAG flow → Cross-encoder: reranks candidates
rag.py - CLI RAG flow → Ollama model: generates answer
rag.py - Search utility → Embedding model: embeds query
search.py - Search utility → Qdrant collection: searches vectors
search.py - Rerank utility → Embedding model: embeds query
reranker.py - Rerank utility → Qdrant collection: retrieves candidates
reranker.py - Rerank utility → Cross-encoder: reranks candidates
reranker.py