Skip to content

Decisions7 min read

An AI assistant that answers from your own documents: how RAG works for a small business

By Published

Short answerRAG, retrieval-augmented generation, lets an AI assistant answer from your documents instead of from memory. Your files are split into chunks, turned into embeddings and stored in a searchable index. When someone asks a question, the system finds the closest chunks and the model writes an answer from them, naming the file it used. The answers are only as good as the documents: outdated, duplicated or missing files give wrong answers with confidence.

What happens between a question and a cited answer

A language model does not know your leave policy or your price list. Google Cloud's RAG Engine overview puts it plainly: models do not understand private knowledge. RAG fixes that by fetching the right passage first and handing it to the model with the question.

Google's overview lists the steps, and every provider follows roughly the same order. Data is ingested from sources such as local files, Cloud Storage or Google Drive. It is transformed, which mostly means split into chunks. Each chunk is turned into an embedding, a list of numbers that places similar meanings close together. The embeddings are indexed. At question time the system retrieves the closest chunks and the model generates an answer with them as context.

Citations come from the retrieval step. In OpenAI's file search tool, the answer carries file_citation annotations with the file ID and filename, so the interface can show which document each answer came from. I would not ship an assistant that cannot show its source. Staff need one tap to check the answer against the document before they act on it.

You do not always need the full machinery. Anthropic's article on contextual retrieval says that if your knowledge base is under 200,000 tokens, you can put the whole thing in the prompt and skip RAG. A small handbook and a price list may fit. A few hundred policy files will not.

Which documents go in, and which stay out

This is where most of the work is. I ask for the documents before I talk about models.

DocumentInclude?What to fix first
Policies staff ask about (leave, refunds, returns, expenses)YesOne current version each, with the date it took effect written inside the file
Price lists and service menusYesRemove old price lists entirely, not just rename them
Product manuals and how-to guidesYesHeadings that name the product, not 'Section 4'
Approved answers to common customer questionsYesAgree the wording with whoever owns customer service
Drafts, old versions, 'final_v3' copiesNoArchive them outside the folder the assistant reads
HR files, salaries, customer records, ID copiesNoThese need access control, not a shared assistant
Scanned pages and photos of documentsOnly after conversionTurn them into real text and check the result

How chunking decides what the assistant can find

The assistant never reads a whole document. It reads chunks.

OpenAI's retrieval guide gives its default: 800-token chunks with 400 tokens of overlap, and you can set the size anywhere from 100 to 4,096 tokens. Its file search tool accepts formats such as PDF, Word, PowerPoint, Markdown, HTML and plain text, and text files must be UTF-8, UTF-16 or ASCII.

The problem is lost context. Anthropic's article describes a chunk that mentions revenue growth without naming the company or the period, so the search cannot match it to a question that does. Their fix, contextual retrieval, adds a short explanation to each chunk before it is indexed. In Anthropic's own tests this cut the rate of failed retrievals by 35% with contextual embeddings, 49% when combined with contextual keyword search, and 67% with reranking added.

I apply the same idea before any code runs, in the documents themselves. Every section should make sense on its own. 'Refund policy for online orders' as a heading, not 'Refunds'. Product names spelled the same way everywhere. A table should say in its title what it lists. Cheap edits, and they help any retrieval method.

Search method matters too. OpenAI's file search uses semantic and keyword search together. If I build the index in PostgreSQL instead, the pgvector extension stores vectors next to the rest of the data, and its README suggests combining it with Postgres full-text search for hybrid search. Keyword search catches exact terms such as order numbers and product codes that meaning-based search can miss.

Keeping the answers current

An assistant that quotes last year's price list is worse than no assistant. Someone has to own the updates.

My rule: every document has one named owner, and when a policy changes, the old file is deleted from the index the same day the new one is added. Adding the new version alone is not enough, because both will be retrieved and the model may pick the wrong one.

The tools help with the mechanics. OpenAI's retrieval guide allows up to 16 attribute keys per file, used to filter search, so you can tag a file with a department or an effective date and search only current files. A vector store can also be set to expire after a period of inactivity, which suits a trial but not a live assistant. If the source is a shared drive, I schedule a sync and log what changed on each run, so someone can see when a file was last picked up.

What it cannot do

Set these expectations before the project starts, not after the first wrong answer.

  • Answer from documents it was never given. The correct reply is 'I could not find this', and you have to test that it says so.
  • Know that a document is out of date. It trusts whatever is in the index.
  • Settle two documents that disagree. It may quote either. Remove the conflict at the source.
  • Make decisions. It can quote the refund policy. A person approves the refund.
  • Keep secrets by itself. If a file is in the index, assume anyone using the assistant can get its contents out. Restrict access by user, or keep the file out.
  • Read every scan or chart reliably. Check converted text by hand before it goes in.

The document pack and test set that sign it off

Before building, I would ask for the document pack. Before launch, I would run a written test set. Both are short enough to finish in a day.

Document pack: a list of every file with its owner and effective date; one version of each policy; old versions removed; headings that name their subject; scans converted and checked; anything personal or confidential taken out or marked for restricted access; a name for who updates the index when a file changes.

Test set: about 40 questions from daily work, written by the staff who will use it, not by me. Each one has the expected answer and the document it should cite. I would split them into groups:

  • Direct lookups, worded the way staff actually talk.
  • The same questions reworded, with typos and short forms.
  • Questions whose answer needs two documents.
  • Questions with no answer in the documents. The assistant must say it does not know.
  • Questions where an old version used to say something different. It must give the current answer.
  • Questions in each language your staff use, if that is more than one.
  • Requests it should refuse, such as another employee's salary.

How I would scope and price an assistant like this

My pass mark is simple. Every answer cites the right document, and no question in the 'not in the documents' group gets an invented answer. One invented answer means more work on documents or retrieval before launch.

A document assistant is a custom AI system, so it is not part of my fixed app packages. It is a fixed quote after a written scope that lists the document sources, who can see what, the languages and the test set. If it sits inside a mobile app, the app itself can be one of the packages: Launch at $999, Growth at $1,699 or Scale at $2,500. Hosting, model and embedding usage and other third-party fees are not included. Send me a list of the documents you would load first and five questions your staff ask every week, and I will tell you whether RAG is needed or whether the whole set fits in a prompt.

Questions

Does the AI provider train its models on the documents I upload?
That depends on the provider, the plan and your settings, and it changes, so check each provider's current data controls page before uploading anything. My article on sending business data to an AI API covers what OpenAI, Anthropic and Google say.
Can the assistant answer in Arabic from English documents?
It can be built to, but I would not assume it works until it is tested. Put Arabic questions in the test set and check that the right English document is found and cited.
Do I need a vector database?
Not always. Hosted tools such as OpenAI's file search manage the store for you. If you already run PostgreSQL, pgvector adds vector search to it. For a very small document set, Anthropic suggests putting everything in the prompt instead.

Sources

Platform rules and fees in this article were checked against these official pages on 11 November 2026. They change, so confirm before you rely on them.

Sannan Malik is a software architect and product builder with 8+ years in software, CEO of Alpha Notic FZE and a Certified Scrum Product Owner. He builds mobile apps and business software for companies in the UAE, the wider Gulf, the UK, the US, Canada and Australia.

Let's build it

Got an idea? Let's talk.

The fastest way to reach me is WhatsApp. Tell me what you're building and I'll reply with how I'd approach it, which package fits, or what a custom scope would look like.

Message me on WhatsApp