Building Production Software

How to Build an AI Chatbot on Your Own Data

A chatbot that answers from your own content can take real work off a support team. One that invents a policy can cost you money, as Air Canada found. This guide covers the build from content to launch.

By Rahul D SarkerPublished November 17, 2026Updated November 17, 20266 min read

Part of our Building Production Software series. Start with Production-Grade Software: Engineering Practices That Prevent Technical Debt.

The Short Answer

How do you build an AI chatbot on your own data?

Gather and clean the content it should answer from, store it in a search index, and connect a language model that retrieves the relevant passages for each question and answers only from them, with a link to the source. Add a refusal rule for questions the content does not cover, a handover to a person, and a set of test questions you run before every change.

The model is the easy part. The quality of a chatbot is set by the quality of the content behind it and by what it does when it does not know.

Read the transcript

In 2022, Air Canada’s website chatbot told a customer he could claim a bereavement fare after his trip. The airline’s real policy said he couldn’t. Air Canada argued it wasn’t responsible for what its chatbot said. In 2024, a tribunal disagreed, and ordered the airline to pay. A company answers for its chatbot, just like any other page on its website. So how do you build one that only says what is true? You don’t train a model. You give it your content to look things up in. Clean the content. Index it. Retrieve the right passages for each question. Answer only from them. And show the source. Then add three guardrails. Refuse when the content has no answer. Hand over to a person. And keep refunds and promises out of scope. Before every release, run the same test questions, including the ones it should refuse. Resolution rate is the number people quote. Accuracy is the number that matters. The model is the easy part. What matters is what it does when it doesn’t know. The full guide is free at loomstrat.com.

Why Accuracy Is a Legal Matter

In February 2024 a Canadian tribunal decided Moffatt v. Air Canada. The airline’s website chatbot had told a customer he could claim a bereavement fare after travelling. The airline’s actual policy said he could not. Air Canada argued it was not responsible for what the chatbot said. The tribunal disagreed, found negligent misrepresentation and ordered the airline to pay the difference in fares.

The sum was small. The principle is not: a company is responsible for what its chatbot tells customers, in the same way as for any other page on its website.

Decide What the Chatbot Is For

  • Audience. Customers, prospects or staff. Each needs different content and a different level of caution.
  • Questions in scope. List the 30 most common questions from your support inbox. That is your first test set.
  • Questions out of scope. Legal, medical or financial advice, complaints, anything about a specific account unless you build secure account access.
  • Actions. Answering is one product. Booking, refunding or changing an order is another, with far more risk. Start with answering.

The Build, Step by Step

  1. 1

    Collect the content

    Help articles, policies, product pages, past support replies. Remove anything out of date or contradictory. If two documents disagree, the chatbot will quote either.

  2. 2

    Split and index it

    Break documents into passages of a few paragraphs, keep the title and section with each one, and store them in a search index. A vector extension in your existing database is enough to begin.

  3. 3

    Retrieve

    For each question, fetch the most relevant passages using both meaning-based and keyword search. Filter by what the user is allowed to see.

  4. 4

    Write the instructions

    Tell the model to answer only from the supplied passages, to cite them, to say when the answer is not there, and to keep to a set tone and length.

  5. 5

    Show sources

    Link each answer to the page it came from so that the user can check it and so that you can.

  6. 6

    Add the refusal and handover

    When retrieval finds nothing relevant, the chatbot says so and offers a person, a form or a phone number.

  7. 7

    Test

    Run the test questions, plus questions it should refuse, and review every answer by hand before launch.

  8. 8

    Launch small

    Release to a share of visitors or to staff first. Read the transcripts every day for the first two weeks.

  9. 9

    Keep the content current

    Re-index when a page changes. Give one person ownership of the knowledge base.

Our guide to RAG versus fine-tuning explains why retrieval, not model training, is the right method here.

Guardrails

Risks and controls for a customer chatbot
RiskControl
Inventing an answerAnswer only from retrieved text; refuse when nothing relevant is found; show the source
Prompt injectionTreat user messages and retrieved documents as untrusted; keep secrets and tools out of reach
Leaking private dataFilter retrieval by the user’s permissions; do not index anything a stranger must not see
Off-topic or offensive useA short scope statement in the instructions and a moderation check on input
Promises the business cannot keepExclude pricing exceptions, refunds and legal commitments, or route them to a person
Runaway costRate limits per user and a cap on message length

The OWASP Top 10 for LLM applications is the standard checklist for these risks.

How to Test and Measure

Chatbot measures
MeasureWhat it tells you
Answer accuracy on the test setWhether changes help or harm; run before every release
Correct refusalsWhether it declines questions it has no content for
Resolution rateShare of conversations that end without a handover
Handover rate and reasonsWhere the content has gaps
User ratingThumbs up or down on each answer
Cost per conversationWhether the economics hold as volume grows

Resolution rate is the number people quote. Accuracy is the number that matters. A chatbot that confidently closes conversations with wrong answers scores well on the first and badly on the second.

  • Say it is a chatbot. Do not present it as a person.
  • Data protection. Conversations often contain personal data. You need a lawful basis, a privacy notice that mentions the chatbot, a retention period and a processing agreement with the model provider. See the ICO’s guidance on AI.
  • Training on conversations. Check whether your provider uses your data to train its models, and turn that off where you can.
  • Consumer law. Statements the chatbot makes about price, rights or terms can bind you. Keep those answers tied to the published policy.
  • Accessibility. The chat window must work with a keyboard and a screen reader; see our guide to web accessibility requirements in the UK.

Buy or Build

If your help desk software includes an AI assistant and your content already lives there, switch it on and test it. Build your own when the chatbot must sit inside your product, use data from your own systems, follow rules a packaged tool cannot express, or keep data within your own infrastructure. A custom chatbot is a normal custom software project; the customer support infrastructure guide covers how it fits with the rest of a support operation.

If buying is the better fit, Loomstrat Helpdesk, built by Loomstrat Labs, includes Spindle, an AI agent that answers only from your own help center and documents, cites the source of every answer and hands the conversation to a person when it isn't sure. It works on any website.

Frequently Asked Questions

Can I train ChatGPT on my own data?

You do not need to train a model. The usual method is retrieval: the chatbot searches your documents for each question and the model answers from what it finds.

How do I stop an AI chatbot making things up?

Instruct it to answer only from retrieved passages, make it cite the source, have it refuse when nothing relevant is found, and test with questions it should not answer.

Is a company liable for what its chatbot says?

Yes. In Moffatt v. Air Canada (2024) a tribunal held the airline responsible for incorrect information given by its website chatbot.

How long does it take to build a custom AI chatbot?

A first version answering from existing help content can be ready in a few weeks. Most of the time goes on cleaning content and testing, not on the model.

What data should I not put in a chatbot?

Anything a member of the public must not see, out-of-date policies, and personal data that is not needed to answer questions.

Does an AI chatbot replace a support team?

It answers common, documented questions. People are still needed for complaints, exceptions, account problems and anything the content does not cover.

Have a build brief already forming in your head?

Loomstrat Studio scopes, builds, and hands over production software in 3–6 weeks - fixed price, 100% repository ownership.

  • Reply within 24 hours
  • Fixed price before we start
  • Zero technical debt guarantee