Build a RAG chatbot: the pipeline from documents to answers
A RAG chatbot answers from your documents by retrieving the right passages first. See each stage of the pipeline, a small code sketch and the failures to test for.
Read articleAn embedding turns a sentence into a list of numbers so search can match meaning, not just words. Learn how it works, what it misses and how to check it on your own content.
By the Askocto team · · 5 min read
A vector embedding is a list of numbers that represents the meaning of a piece of text. Two passages that mean similar things get lists that sit close together, and two unrelated passages get lists that sit far apart. Search systems use this to find the part of your content that best matches a question, even when the customer uses different words than your help center does.
In short: Embeddings let search match meaning instead of exact words. They are strong on paraphrases and weak on exact codes, names and negations, so test them on your own questions and pair them with keyword matching where needed.
Imagine placing every sentence on a map. Sentences about refunds land in one area, sentences about delivery in another, sentences about password resets in a third. Two sentences about the same thing sit near each other, whatever words they use. A vector embedding is the coordinates of a sentence on that map.
A real embedding has hundreds or thousands of coordinates, not two, so no one can draw it. The principle is the same as the toy map below.
"How do I get my money back?" -> (0.82, 0.10)
"Refund policy for returned items" -> (0.79, 0.14)
"Where is my parcel?" -> (0.12, 0.88)
These two-number coordinates are made up to show the idea. The first two sentences share no key words, yet they sit close together. The third sits far away. A search system finds the closest points to the question and returns those passages.
The usual sequence has four parts:
The chunks then go to a language model that writes the answer. The full flow is described in how to build a RAG chatbot, and RAG from scratch goes into the construction in more depth.
One rule matters a lot: the question and the content must be embedded with the same model. Switch models and every stored vector has to be recomputed, or the matches become meaningless.
Embeddings handle the way customers actually write:
This is why a support agent can answer from a help center without a hand-written list of keywords for every article.
| Weak spot | Example | Why it happens | What helps |
|---|---|---|---|
| Exact identifiers | Order code, SKU, error code | The code carries little meaning to match | Keyword search alongside embeddings |
| Negation | "Can I cancel?" and "I cannot cancel" | Opposite meanings can land close together | Reading passages in context, reranking |
| Numbers and dates | "30 days" versus "14 days" | Small numeric differences barely move the vector | Clear headings and one fact per chunk |
| Near duplicates | Policies for two regions | Both sit close to the question | Separate sources, labels, a second ranking pass |
| Very long chunks | A 3,000 word page | The vector blurs many topics together | Smaller chunks with a clear subject |
Many systems combine embeddings with keyword search, called hybrid search, so exact terms and meaning both count. A second pass over the results can also help, as covered in reranking.
Even when a platform handles embeddings for you, the quality of the match depends on what you feed it.
In Askocto the embedding step happens when a source is trained. You add a website, files, text or Q&A pairs under Build > Sources, wait for the status to reach Ready, and use Auto-retrain on a schedule so new content gets embedded. Retraining after you edit a page matters, because an old vector keeps matching old wording.
You do not need to inspect any vectors. Test the behavior.
Repeat the same list after each content change, and note which questions Askocto answers from the wrong source. If misses cluster around codes and SKUs, add Q&A pairs that name them. The Sources guide lists the options, and the product overview shows where testing fits.
When answers still drift from your sources, the controls in AI hallucination cover the next layer.
It is a list of numbers that stands for the meaning of a text. Texts with similar meanings get similar lists, which lets a search system match by meaning instead of by exact words.
Keyword search looks for the same words. Embedding search looks for the same meaning. Each catches things the other misses, so many systems use both.
Not when you use a platform. You add sources and the platform embeds them when it trains. You still control the quality of the content that gets embedded.
Embeddings represent meaning, and a code has little meaning to match. Add a Q&A pair or a clear sentence that names the code and what it refers to, and test again.
Askocto answers the repeat questions across chat, email and voice and hands the hard ones to your team.
A RAG chatbot answers from your documents by retrieving the right passages first. See each stage of the pipeline, a small code sketch and the failures to test for.
Read articleRetrieval finds candidates and reranking puts them in the right order. See how the second pass works, when it is worth the extra step and how to measure the gain.
Read articleRAG gives a model the right passages at question time. Build a minimal version in six steps, see where it breaks and decide when to use a platform instead.
Read article