# Build a RAG app: paste it, use a ready-made tool or build it

Should you build your own RAG or use a ready-made tool? We built 3 versions on the same washer manual, pasting the whole manual, Gemini's File Search and our own pipeline, and asked each the same 20 questions with known answers. This lesson shows what each one does, how to test a RAG app with a question set, the scores, speed and cost we got, and the questions RAG still gets wrong.

- Page: https://tecyfy.com/learn/rag/build-a-rag
- Path: RAG: AI that answers from your documents (https://tecyfy.com/learn/rag), lesson 3 of 3
- Full video (11:33): https://www.youtube.com/watch?v=9QEuajxVbCI

## 3 ways to build it

Watch this part (52 s): https://www.youtube.com/shorts/HaRZpZ4YiPA

Every RAG app answers the same kind of request: "My washer shows E21. What do I do?", asked of a manual the model never read. [What is RAG?](/learn/rag/what-is-rag) followed that question through the 4 steps, and [How RAG search works](/learn/rag/how-rag-search-works) took the search apart. This lesson builds the thing, 3 ways, on the same Sudsley S7 manual.

The Paste build reads the whole manual every time. The Ready-made build is a tool you use: upload the manual and it does the rest. The Home-built build is ours, made from the parts of the search lesson.

One question proves little, so we wrote 20, each with a known answer from the manual, and asked every build every one, twice, on 8 October 2026. The scores, speed and cost below are what we got.

## Just paste it

Watch this part (51 s): https://www.youtube.com/shorts/MuoKbN0Gjbg

The Paste build is not really RAG. It hands the model the whole manual with every question, plus the same rules as before: use only these pages, say which page, and say if you don't know.

Our manual is small: 60 pages come to about 9,300 [tokens](https://tecyfy.com/concepts/token), a small slice of what today's models read at once. The rule of thumb from the first lesson applies: under about 200,000 tokens, roughly 500 pages, you can put it all in.

We tested it anyway because it is the baseline. Any search we add has to beat "just read everything", or it is not worth building.

## The ready-made tool

Watch this part (1:28): https://www.youtube.com/shorts/BsYElajTNM8

The Ready-made build is what builders call a managed tool. We used Gemini's File Search: make a store, upload the manual, and that is the setup.

Inside, it does the first 2 steps of RAG for you. It cuts the file into [chunks](https://tecyfy.com/concepts/chunking), embeds them, stores them, and at question time finds the closest by meaning. You can set the largest chunk size and how much neighbouring chunks overlap. Answers come with citations naming the part of your file used, and the page number for a document with pages.

You pay once for the embeddings when your files are indexed. Storage is free, and so is embedding each question. Then you pay the normal price for the model's input and output tokens, and the input includes the chunks the tool pulls in. On the free tier, input and output tokens are free on the models it offers.

OpenAI's file search is the same idea with more of the search lesson built in: it runs semantic and keyword search, merged, and its search takes a ranker setting. We tested Gemini's tool; OpenAI's we describe from its documentation.

The upside of a managed tool is nothing to build. The catch is that the choices are made for you: how chunks are cut, which search runs and how results are ranked come as a few settings, not the whole machine.

## Your own pipeline

Watch this part (1:25): https://www.youtube.com/shorts/yRR1SL33lfM

The Home-built build is the search lesson, built for real, in 5 parts.

1. **The cards.** We cut the manual along its own structure, one card per table row or paragraph, and gave each a short note: the manual, the page, the heading.
2. **An embedding model** turns every card and every question into a list of numbers. We used Google's.
3. **Somewhere to keep the numbers** and find the nearest fast, a [vector database](https://tecyfy.com/concepts/vector-database). With 237 cards ours is a file. With millions you would want a real one, built to search that many quickly.
4. **A keyword index** beside it, for exact codes and part numbers, and a step that merges the 2 lists: [hybrid search](https://tecyfy.com/concepts/hybrid-search).
5. **A [reranker](https://tecyfy.com/concepts/reranking)** that reads the question with the top 20 cards and orders them. The top 3 then go into the same prompt as the Paste build, to the same model.

It is more work, and every choice is yours. You can cut a table row by row, add notes, change how many cards go to the model and see exactly why a card won.

## Where LangChain and LlamaIndex fit

Watch this part (47 s): https://www.youtube.com/shorts/RqmAtAsDMJk

You will hear [LangChain](https://tecyfy.com/concepts/langchain) and [LlamaIndex](https://tecyfy.com/concepts#llamaindex) a lot. They are toolkits, not a new kind of RAG. LangChain gives one interface for chat models, embeddings and more across providers, so switching a model is a small code change. LlamaIndex is an open-source toolkit for RAG and agents over your own data, with ready-made ways to load, index, store and query it.

They help when you would otherwise write a lot of glue between the parts. They are not required: our Home-built build is about 110 lines of code, with no framework. Whichever you choose, the parts and the questions to ask about them are the ones from the search lesson.

## How to test it

Watch this part (1:22): https://www.youtube.com/shorts/X7fZkaereGM

A RAG app is tested with a question set, which builders call an [evaluation set](https://tecyfy.com/concepts/eval-set). Ours has 20 questions, each with the page that answers it and the facts a right answer must contain.

We wrote it before running anything, so it could not be bent to the results. It has everyday wording like "the water just sits there", codes and part numbers, 2 questions whose answer is a whole list, and 2 the manual cannot answer, to see whether a build admits it.

Then 2 measures. Did the search bring back the right page? That is [retrieval](https://tecyfy.com/concepts/retrieval-evaluation). Is the answer fully right, every fact and nothing wrong? That is answer quality, and it is the score that counts.

Keep them apart, because they point to different fixes. If the right page never came back, fix the search. If it came back and the answer is still wrong, look at what was handed over and at the prompt. And keep one fair rule: the same model and the same instructions in all 3 builds, so the only difference is how the pages are found.

## The results

Watch this part (2:10): https://www.youtube.com/shorts/qyenZ7MQFNE

First, E21. All 3 builds got it right: switch off, clean the drain filter behind the flap at the bottom right, check the hose. All 3 pointed to page 34.

Then all 20, run twice, counting answers that were fully right:

| Build | Run 1 | Run 2 |
| --- | --- | --- |
| Paste the whole manual | 19 of 20 | 19 of 20 |
| Ready-made (Gemini File Search) | 19 of 20 | 18 of 20 |
| Home-built, first version | 14 of 20 | 14 of 20 |
| Home-built, fixed | 19 of 20 | 18 of 20 |

The surprise was the first Home-built score. By the first measure our search was perfect: for every question the manual answers, the right page was among our 3 cards. So why 14?

Because the right page is not the same as the right text. A list of 4 error codes does not fit on 3 cards. A few answers left out a step that was on the card. And one was our own bug: our cards had dropped every bulleted list, so the card for the Quick 30 wash ended at "To set it:" with no steps. Right page, missing text, and the model rightly said it did not know.

That is what a question set is for. It found our bug. We fixed the cards so a list stays with the paragraph above it, handed over 10 cards instead of 3, and ran all 20 again, twice: 19 and 18, level with the other 2.

Speed and cost per question changed the picture. The Paste build took about 4 seconds and about 2 cents. The fixed Home-built build took about 5 seconds and under 1 cent. The Ready-made build took about 24 seconds and, because it pulls in big chunks, about 3 cents, the most of the 3. One question tripped it up completely: asked about Wi-Fi, which the manual never mentions, the other 2 said "I don't know" in about 4 seconds. The Ready-made build gave no answer at all, once an empty reply after 2 minutes, once still working when we stopped it at 3.

## Which one should you pick?

Watch this part (52 s): https://www.youtube.com/shorts/fcUm57oLKHg

Small and stable, like one manual: paste it all in. There is nothing to build, and the model sees everything.

Bigger or changing, and you want it working this week: a managed tool. Upload and go, but time it and price it on your own questions first. In our test it was the slowest and the most expensive per question.

Build your own when the defaults get in your way: tables that need cutting row by row, codes and part numbers that need keyword search, rules on who may see which document, data that cannot leave your own servers, or a cost you need to control at scale.

Whichever you pick, keep the question set, and run it again every time you change something.

## Where RAG still fails

Watch this part (1:28): https://www.youtube.com/shorts/dl3BSNrADz8

List questions are the classic trap. "List all the F codes" has 4 codes in 4 rows of a table. With 3 cards, our build listed 3 and presented them as the full list. Nothing warned us; only the question set caught it. With 10 cards, it got all 4.

A code that is not there went better. Asked "What does E99 mean?", every build said "I don't know", with no guess from the E codes that look alike. That is the instructions from the first lesson doing their job.

Questions about the whole document are hard: "Summarise this manual" needs every page, not the 3 closest. Pictures and diagrams are a problem when only the text is embedded, because a question about a diagram has nothing to find; Gemini's File Search can now embed and search images as well. And RAG is only as good as its documents. An old manual gives old answers, and 2 documents that disagree give the model 2 answers to choose from.

One more for companies: who may see which document. A search that finds everything can show everyone everything. Managed tools let you tag files with metadata and filter on those tags.

## The 3 builds, and a quick test

Watch this part (1:06): https://www.youtube.com/shorts/6GwfmyFef_w

3 ways to answer from your documents: paste it all for small and stable, a managed tool to start fast, your own pipeline for control. Your own is the parts of the search lesson: chunks with notes, an embedding model, a vector database and a keyword index, a merge, a reranker and the model. Frameworks are glue for those parts, not a different kind of RAG. And test it with a question set that measures 2 things, whether it found the right page and whether the answer is fully right, the second being the score that counts.

A quick test. A list question keeps failing: the answer is spread over 4 rows, and your app hands the model only the top 3. What do you change? Hand over more chunks, by raising the top-k or cutting bigger chunks for tables like that one. Then run the question set again, to check nothing else broke.

## Start with 20 questions

Watch this part (37 s): https://www.youtube.com/shorts/pqA0silyB7Y

Don't start with the fanciest build. Start with 20 questions you know the answers to. They tell you whether you need RAG at all, and which kind, and when a change breaks something, they tell you that too.

That is the series: one question, "My washer shows E21", from the first step to a working app. If the bill matters as much as the score, our [token cost calculator](/prices/cost-calculator) prices the text each build sends to the model.

## What changes for you

It is easy to start a RAG app by picking the fanciest tool. Start instead with 20 questions whose answers you know, because they tell you whether you need search at all, which kind, and what broke when the score drops.

## Try it with your own AI: Catch the list trap, then write your own question set

This takes about 10 minutes in any assistant. The first 2 prompts show the most common way a RAG app goes quietly wrong. The third turns a document of your own into the question set this lesson is about.

1. Send the first prompt in a new chat. It is what a RAG app sends when its search hands over only the top 3 cards and the answer is spread over 4.
2. Send the second prompt in a new chat. It is the same message with all 4 rows, as if the app handed over more cards.
3. Send the third prompt in a new chat, with a document of your own pasted where it says, one with nothing private in it.

Prompt 1. Top 3 cards for a list question

```
Answer the customer's question using only the cards below. Say which card you used. If the answer is not in these cards, say you don't know.

Card 1, error codes: F06 door lock fault. Switch off for 1 minute and close the door firmly.
Card 2, error codes: F07 motor fault. Call a technician.
Card 3, error codes: F09 drain pump fault. Clean the drain filter, then call a technician if it returns.

Question: List all the F codes for the Sudsley S7 washer and what each one means.
```

Prompt 2. The same question with 4 cards

```
Answer the customer's question using only the cards below. Say which card you used. If the answer is not in these cards, say you don't know.

Card 1, error codes: F06 door lock fault. Switch off for 1 minute and close the door firmly.
Card 2, error codes: F07 motor fault. Call a technician.
Card 3, error codes: F08 water level sensor fault. Call a technician.
Card 4, error codes: F09 drain pump fault. Clean the drain filter, then call a technician if it returns.

Question: List all the F codes for the Sudsley S7 washer and what each one means.
```

Prompt 3. Write a question set for your own document

```
Below is a document I want an AI app to answer questions from. Write a test set of 12 questions for it, as a table with 4 columns: the question, the facts a fully right answer must contain, where in the document the answer is, and the kind of question. Include: 4 questions in the everyday words a user would type, not the document's words; 3 that use an exact code, number or name from the document; 2 whose answer is a list spread over several places; 1 that needs the whole document; and 2 the document cannot answer, with "not in the document" as the right answer.

[paste your document here]
```

What to look for:

- The first answer lists F06, F07 and F09 and probably presents them as the full list. Nothing in its reply warns you that F08 exists, because the card never reached it. That is the list trap, and only a question with a known answer catches it.
- The second answer lists all 4. The model did not get smarter between the 2 chats. It got more cards.
- In the third answer, check the "not in the document" questions really are not answered anywhere, and that the facts column is specific enough to mark an answer right or wrong. Save the table. It is the test you run every time you change your app.

## Check yourself

1. Your RAG app hands the model the top 3 chunks. A question whose answer is spread over 4 rows of a table keeps coming back with 3 of them. What do you change, and what do you do after?

   A. Switch to a larger model, which will notice that a row is missing.
   B. Add "be complete" to the instructions, and ship the change.
   C. Hand over more chunks, or cut that table into bigger chunks, then run the question set again.
   D. Remove the table from the documents, since tables cannot be searched.

2. You test a RAG app with 20 questions. For every question the right page was retrieved, yet only 14 answers are fully right. What should you check before anything else?

   A. The text that was actually handed to the model, and the prompt.
   B. The embedding model, because the search is not finding the right pages.
   C. The vector database, because it is returning pages too slowly.
   D. The questions, because 14 out of 20 means they were too hard.

3. A team has one 60-page product manual that changes once a year and wants an assistant to answer from it this week. Which build does this lesson suggest trying first?

   A. A home-built pipeline with hybrid search and a reranker, for the most control.
   B. A managed file search tool, because it scales to millions of pages.
   C. A framework such as LangChain, because RAG needs one.
   D. Paste the whole manual into the prompt with the same rules, and test it on known questions.

### Answers

1. C. The model can only list what it was handed, so the fix is to hand over more, by raising the top-k or cutting tables like that one into bigger chunks. Then run the whole question set again, because a change that fixes one question can break another. In our test, 10 cards instead of 3 fixed the list question.
2. A. Retrieval was perfect, so the search is not the problem. The right page is not always the right text. In our test the cards had dropped every bulleted list, so a card ended at "To set it:" with the steps missing. Keeping retrieval and answer quality as 2 separate scores is what points you to the right fix.
3. D. A small, stable document fits easily in today's context windows, and in our test pasting the whole manual scored highest. Any search has to beat reading everything to be worth building. A managed tool or your own pipeline earns its place when the documents are bigger or change often, and a framework is optional either way.

## Sources

1. [Introducing Contextual Retrieval](https://www.anthropic.com/news/contextual-retrieval)
2. [File search](https://ai.google.dev/gemini-api/docs/file-search)
3. [Gemini Developer API pricing](https://ai.google.dev/gemini-api/docs/pricing)
4. [File search](https://developers.openai.com/api/docs/guides/tools-file-search)
5. [Retrieval](https://developers.openai.com/api/docs/guides/retrieval)
6. [LangChain overview](https://docs.langchain.com/oss/python/langchain/overview)
7. [LlamaIndex Framework](https://developers.llamaindex.ai/python/framework/)
