Automation Documentation · RAG systems

AI search over your own documentation

Ask your documentation and know where every answer comes from

Every answer with its source cited Citations checked against the original Calculations are not done by the model Evaluated on your team's cases
Rc retrieve

The problem

Some questions require investigating several documents at once. A regulatory analysis is the clearest example. To know what can be done in a specific case, you have to go through four documents with more than three thousand articles and clauses. One sets the rule, another brings the exception, a third refers to a different regulation, and some still cite the numbering from before the latest reform. Missing one of those references changes the conclusion.

The same happens with contracts, manuals and internal procedures. The answer is spread across different sources that complete, amend or cite one another.

Today that is solved by someone who knows the material. They know where to look. They remember which article amends which and when the exception applies. It works as long as that person has time, and when they do not, the query waits. The search box in the document management system is of little help. It returns thirty documents containing the word, and reading them is still the work.

The solution

The solution is a RAG system (retrieval-augmented generation). Before answering, the system searches your documentation for the fragments that deal with the question, and the model writes the answer only from them. The documentation is split into fragments following its own structure, one per article or clause, so that each keeps its full meaning when retrieved. The search is hybrid. It combines search by exact terms, like a search engine, with semantic search, which finds the fragments that talk about the same thing even if they use other words. Every statement carries the literal sentence it comes from, and before delivering, the system checks that the sentence is in the cited document. If it is not, the citation does not pass.

When an article refers to another, the system pulls in the other one too. When the documentation uses terms that were renamed in a reform, a glossary translates them before searching. Those are the two things that someone who knows the material does from memory, and the two that a generic prompt fails to handle.

The model reads the documentation and determines which rule applies. If that rule produces an amount through a fixed formula, a block of code does the calculation, and the model writes the answer with that result. The system does not make the decision either. It delivers the answer with its sources, and whoever uses it checks it against the original before acting.

Why pasting the document into a chat is not enough

With a document of reasonable size, pasting it whole into an assistant can give good answers. The difference shows up in three situations.

  • When the documentation is so extensive that it does not fit at once into what the model can read. The four documents in the regulatory analysis, taken together, do not fit.
  • When the answer has to be auditable sentence by sentence.
  • When the question combines the text with data and calculations.

We tested the system from the example on four real cases. We asked it for the analysis of each one without showing it the report a professional had already written. The regulatory framing matched in all four. Where there were differences, the most frequent cause was outdated public data, not the reading of the regulations. All 91 citations in that test were checked against the original text, and all 91 were verbatim. Our design criterion is that every citation must appear, verbatim, in the document it cites. A citation that does not appear counts as a failure.

More on the blog: How a RAG system works and when to use one →

How it integrates

The documentation stays where it is. The system reads it there and, when a file changes, only that file is processed again. The result takes the form the process needs. It can be a report for human review, with each citation linked to the original passage so it can be checked before use. Or it can be a step in an automated workflow, where the answer feeds the business decisions that come next. In both cases, before it is put into use it is measured against queries that your team has already resolved and whose correct answer is known, and that test is repeated whenever the documentation or the system changes.

Same system, different documentation

It works wherever the answer depends on a careful reading of a long body of material that cites itself.

01

Regulation and compliance.

What the regulation requires for a specific case, with the article and the exception that applies. Used by the compliance team or the legal department.

02

Contracts with customers or suppliers.

What each contract says about renewals or penalties, and how they differ from one another. Used by procurement or the legal department.

03

Internal procedures.

How a situation is resolved according to the current manual, for whoever is handling it and cannot wait for the person who knows. Used by support or operations.

Related cases
Customer data enrichment → Multi-agent systems →