Skip to content

An AI chatbot on my own website that answers from the site’s pages, shows which pages it used, and passes the rest to WhatsApp.

Client
Kuraib Ali (in-house build)
Sector
Own business · website AI chatbot
Timeframe
Running on kuraib.site, recorded November 2026
Engagement
In-house: built and run on my own website, not a client project

Diagram

How the retrieval-augmented generation (RAG) chatbot on my website answers

The question is matched against passages built from my site, the best ones go to the language model, and the reply shows up to three source pages.

  1. VisitorAsks in the chat on my website
    Then: Question
  2. SearchBy meaning and by exact words
    Then: Looks up
  3. My site’s pagesPassages built from the site at build time
    Then: Best passages
  4. Language modelTold to answer only from those passages, no prices of mine
    Then: Answer
  5. ReplyWith up to three source pages

No passage covers it? The chatbot says so and points to WhatsApp.

In short

A RAG chatbot (retrieval-augmented generation) looks up passages from a business’s own content first, then has the AI model answer from those passages only. I built one for my own website. Its index is made from the site’s pages at build time, each answer lists the pages it used, prices of my own services are never quoted, and a short name and email form before the first chat emails me the lead. It is in-house work.

The situation

Visitors to my website ask questions the pages already answer, but the answer can sit three clicks away.

A general AI chatbot would answer them quickly and also make things up: a price I never set, a result I never had. I wanted a chatbot that reads only my own pages, names the pages it used, refuses what they do not cover, and tells me who started a chat. This is an in-house build for my own website, not a client project.

A frame from my RAG explainer film, with sample data: the question "What time do you open on Saturdays?" is matched by meaning to the opening hours and weekend rota passages.

The move

  1. 01

    Build the index from the site itself. At the start of every build a script reads the site’s own content (posts, case studies, offers, the services pages, About and the site facts), cuts it into passages of about 220 words, and stores an embedding (a list of numbers that captures meaning) for each. A passage whose text has not changed keeps its stored vector, so a routine deploy embeds nothing new. A GitHub workflow commits the index when content changes on the main branch, and the build never fails for want of it: passages without a vector fall back to keyword search.

  2. 02

    Search two ways, then answer from the results only. Each question is matched by meaning (embeddings) and by exact words (BM25 keyword ranking), and the two lists are merged, so an exact term is never pushed out by a vague neighbour. The top passages, at most two from one page, go to the model with rules: answer only from them, say so when they do not cover the question and point to WhatsApp, never state a price for my services, never promise a result.

  3. 03

    Show the sources and leave some things out. The model ends each answer with the passage numbers it used, and the visitor sees up to three source pages as links. Pages about the brokerage where I work in-house are kept out of the index and of the WhatsApp assistant, my decision of 8 October 2026, and a check reads the committed index to confirm it.

  4. 04

    Capture the lead, then get out of the way. Before the first chat, a short form asks for a name and email, phone optional. It is emailed to me and recorded as a lead event in Google Tag Manager. If the email fails, the visitor still chats. Each address can ask 20 questions in ten minutes, with a daily cap for all visitors, so one person cannot run up the model bill.

A person typing a question into an AI chat assistant on a smartphone.

Photograph Zulfugar Karimov, Unsplash

What changed

States of the system, not metrics. These are things that either were or were not true, so they can be stated without claiming a result.

Before and after states for the Kuraib Ali (in-house build) engagement.
BeforeAfter
Where answers come fromA general model’s memoryPassages from the site’s own pages only
A question the pages do not answerA confident guessSaid plainly, with WhatsApp offered
A question about my pricesWhatever the model saysNo figure; a pricing PDF on request
How a visitor checks an answerThey cannotUp to three source pages linked under the reply
Who started a chatUnknownName and email emailed to me before the first chat
When the content changesNot applicableThe index is rebuilt from the pages on the next build

Scroll sideways to compare

What shipped

  • Build-time index of the site’s own pages, about 220 words per passage, with embeddings reused when the text is unchanged
  • Hybrid retrieval: embeddings and BM25 keyword ranking, merged by rank
  • Answer rules: context only, no prices of my own, no promised results, hand-off to WhatsApp
  • Up to three source pages shown under each answer
  • Exclusion filter for one business, checked against the committed index
  • Name and email form before the first chat, emailed to me, with a honeypot field for bots
  • Rate limits per address and a daily cap for all visitors
  • Backup answer models when the first is out of free quota, and a plain message when all are

The scorecard

What this build was held to, and how each item was checked.

Index size
841 passages, 63 pages
api/_rag/index.json as committed, read 29 Nov 2026, before these case pages were added; every passage has a 256-dimension embedding
Passages naming the excluded business
None
A check in scripts/wa-test.mjs reads the committed index
Endpoint tests
11 of 11 passing
Vitest, run 29 Nov 2026: tests/chatbot-lead.test.mjs, tests/gemini.test.mjs and the chatbot and lead cases in tests/abuse.test.mjs
Questions per address
20 per 10 min
Server-side limit in api/gemini.js, plus a cap of 600 a day for all visitors
Sources shown per answer
Up to 3
Set in api/gemini.js from the passage numbers the model names

Each row is a property of the system, read from the code, its tests or the committed index on the date given. This is an in-house build for my own website, not a client project.

Questions about the RAG website chatbot

What is a RAG chatbot?

RAG stands for retrieval-augmented generation. The chatbot first looks up passages from the business’s own content, then the AI model writes its answer from those passages only, instead of from its general memory.

Is this a client project?

No. It is an in-house build that runs on my own website.

How is the index built?

A script runs at the start of every build. It reads the site’s own content, cuts it into passages of about 220 words, and stores an embedding for each. Unchanged passages keep their stored vectors, and a GitHub workflow commits the index when content changes.

What does it refuse to say?

It never states a price for my services, never promises a timeline or a result for the visitor’s project, never speaks as me, and declines questions unrelated to my work. When the pages do not cover a question, it says so and points to WhatsApp.

Is anything left out of the index?

Yes. Pages about the brokerage where I work in-house are kept out of both the website chatbot and the WhatsApp assistant, by my decision of 8 October 2026. The pages stay on the site; the chatbot never reads them.

How are leads captured?

A short form before the first chat asks for a name and email, phone optional. It is emailed to me and recorded as a lead event in Google Tag Manager. If the email fails, the visitor can still chat.