Home / Notes / RAG

An assistant over your company documents

Almost everyone arrives with the same sentence: we have a lot of documentation and nobody can find anything. The AI part of that problem was solved a while ago. What stretches the project is something else, and it is worth knowing before you start.

Anyone can build the demo in an afternoon: take twenty PDFs, chunk them, push them into a vector store, and you have an assistant that answers over them. It looks great in the meeting. Then reality arrives, and reality is not twenty PDFs. It is nine thousand files spread across a network drive, three Drive folders, a document management system nobody maintains, and the mailboxes of two people.

A RAG demo has documents, semantic search and a model. A production system adds permissions, version control, chunking by type, hybrid search, source citation and continuous evaluation.

That is where it is decided whether the project ships or stays a permanent demo. These are the pieces that decide it, ordered by how much trouble they cause.

What delays these projects is almost never the AI. It is permissions, and deciding which version of each document is the right one.

Who is allowed to see what

This is the first question and the one most people skip. If your company has documents only the board should see, or payroll only HR should see, the assistant has to respect that. And it is not solved by asking the prompt to keep quiet about it: it is solved by filtering before you search, so the documents that person cannot see never enter the answer in the first place.

A system that answers well but shows things to the wrong people is not a system that half works. It is one you cannot deploy.

Which version is the current one

The 2021 protocol, the same protocol revised in 2023, and an annotated copy someone left in their own folder. All three say different things and all three are in there. If the assistant treats them equally, it will answer with total confidence using the wrong one. That is worse than having no assistant, because people will believe it.

There is no technical shortcut. Somebody inside the company has to decide what is current. What you can do is make that easy: detect duplicates and near-identical versions, and produce a conflict list so that person decides once instead of a thousand times.

How documents are chunked

A contract is not chunked like a manual, and a price table is not chunked at all: it is converted. Cutting every 500 words is what everyone does at first, and it causes half the bad answers, because it splits a condition down the middle and the fragment that reaches the answer says the opposite of what the whole document says.

Search twice, and in two different ways

Semantic search finds what is similar, but it fails exactly where it hurts most inside a company: reference codes, part numbers, proper names. Keyword search does the opposite. You need both, and then a reranking step that decides which candidates actually make it into the answer.

Cite the source, every time

Every answer has to say which document it came from and which part. This is not decoration: it is what makes the assistant verifiable. Whoever uses it can check in two seconds whether it is telling the truth, and that habit is what makes people adopt it instead of distrusting it.

And know whether it is right

Fifty real questions, taken from what people actually ask, with the correct answer and the correct source written down. You run all of them every time you change something. Without that you do not know whether your last change improved the system or made it worse, because an AI system does not break with an error: it keeps answering, only worse.

If the documents cannot leave the company

This comes up more often than you would think: health data, legal files, client information under contract. In that case the model runs on a server the company owns or on a dedicated GPU, and no document travels to a third-party API. It costs more to operate and it should be a deliberate decision rather than a fashion. I have been doing it for two years with clinical data.

How long it takes

Over a bounded corpus, two to three weeks including evaluation, with working pieces from week one. That timeline holds most of the time, and when it slips it is always for the same reason: nobody knew who granted access permissions, or nobody was deciding which version of each document is current.

If this sounds like your company, tell me through the contact form and I will tell you what I would do, how long it would take, and whether you actually need AI to solve it. If you would rather see the technical detail first, it is on the RAG to production page.