— 17 November 2026

Answering from your own documents with AI, without overbuilding

How retrieval-augmented generation (RAG) lets an AI answer from your company's documents — when you need it, the simplest version that works, and the parts that actually decide quality.

  • AI
  • Technical

“Can we have a chatbot that answers from our documents?” is one of the most common AI requests we get. The answer is yes, and the technique has a name — retrieval-augmented generation, or RAG. It is also one of the easiest AI features to overbuild.

How it works

  1. Prepare: split your documents into passages and index them so they can be searched.
  2. Retrieve: when a question comes in, find the passages most likely to contain the answer.
  3. Generate: give the model the question plus those passages, and instruct it to answer only from them — and to say so when they do not cover the question.

The model is not “trained” on your documents. It reads the relevant pieces fresh for each question. That means updates to your documents show up immediately, and answers can point to their source.

First question: do you need retrieval at all?

Modern models can read a lot of text in one go. If your knowledge base is a handful of policies and a product list — tens of pages, not thousands — you may not need a retrieval system. Pass the whole thing in, with prompt caching to keep it cheap, and ship.

Retrieval earns its place when:

  • The documents are too large to send with every question
  • Cost per question matters at your volume
  • Different users should see different documents

The simplest retrieval that works

You probably do not need a specialist vector database. If you already run Postgres — including on Supabase — the pgvector extension stores embeddings next to your data. Combine it with ordinary keyword search, because people often search for exact product codes, names and numbers that embeddings handle poorly.

A small stack:

  • Your documents in a database or storage bucket
  • An embedding model to index passages
  • Postgres with pgvector plus full-text search
  • An LLM such as Claude for the answer
  • A small API that ties them together

That is weeks of work, not months.

What actually decides quality

Teams spend weeks choosing models. Quality is almost always decided elsewhere.

Source content. If the documents contradict each other or are out of date, so will the answers. Clean up the content first. This is the most valuable step and the least glamorous.

How documents are split. Split by meaningful sections — headings, clauses, FAQ entries — not every 500 characters. Keep the title and section name with each passage so it makes sense on its own.

Retrieval tested on real questions. Collect 50 real questions your team or customers ask. For each, check whether the right passage comes back in the top few results. If it does not, no model will answer correctly.

A strict instruction. Answer only from the provided passages; cite them; say “I don’t know” otherwise. This removes most invented answers.

Permissions. If some documents are internal, retrieval must filter by who is asking — before the model sees anything.

Where it goes wrong

  • Indexing everything, including drafts and outdated versions
  • No evaluation set, so every change is guesswork
  • Answers without sources, so nobody can check them
  • No feedback button, so you never learn which answers were wrong

Good first uses

  • An internal assistant for policies, SOPs and product specs
  • A customer support assistant grounded in your help content — on your site or on WhatsApp
  • A sales assistant that answers technical product questions from datasheets

Keep the first version narrow, measure answer accuracy on real questions, and grow from there. Our LLM integration checklist covers the rest of the rollout, and what AI actually costs covers the running cost.

This is the work behind our ai features service.

? COMMON QUESTIONS

Questions people actually ask.

What is RAG in simple terms?

Retrieval-augmented generation means that before the AI answers, your system searches your own documents for the relevant passages and gives them to the model along with the question. The model answers from those passages instead of from general knowledge, and can cite where the answer came from.

Do I need a vector database?

Not always. If your documents fit comfortably within the model's context window, you can pass them in directly. For larger collections, a vector index in a database you already use — such as Postgres with pgvector on Supabase — is usually enough. A dedicated vector database is only necessary at large scale.

Why does my document chatbot give wrong answers?

Usually because the right passage was never retrieved — documents were split badly, the search missed the wording, or the source documents are out of date or contradictory. Fix retrieval and the source content first; changing the model rarely helps.

3 RELATED READING

Next to this one.

→ NEXT STEP

Have a product to ship?

Start a project ↗ hello@napdesigns.com