Building a RAG Pipeline from Scratch
How I built BusyChat's retrieval pipeline — crawling a site, chunking it, embedding into a vector store, and serving grounded answers instead of hallucinations.
When I set out to build BusyChat — an AI support chatbot that answers from your own website — the hard part wasn't calling an LLM. It was making sure the answers were actually grounded in the customer's content instead of confidently made up.
Crawl, don't guess
The pipeline starts by reading the site's sitemap.xml and walking every page. An event-driven crawler fetches each URL, strips the boilerplate, and keeps the meaningful text. Working from the sitemap means I get the pages the owner actually cares about, in a predictable order.
Chunking is where quality is won or lost
Raw pages are too big to embed usefully, so each one is split into overlapping chunks sized for the embedding model. Too large and retrieval gets vague; too small and you lose context. The overlap keeps sentences from being cut off mid-thought.
Embed and store
Each chunk becomes a vector and lands in Cloudflare Vectorize alongside metadata — source URL, title, section. At query time the user's question is embedded the same way, and the closest chunks come back as context for the model.
Grounding the answer
The retrieved chunks go into the prompt with strict instructions: answer only from this context, and say you don't know otherwise. That one rule is the difference between a demo and something a business can put in front of real customers.
Building it from scratch — instead of reaching for a framework — meant I understood every failure mode, which made the later work on retrieval quality and trigger matching far easier.