A RAG system searches for passages in a document base to help a model respond. Its reliability depends first of all on the documents, their access rights and their freshness. Start with a controlled perimeter, with verifiable answers, before expanding the corpus.
Choose useful questions
List the tasks that the assistant should help accomplish: understanding an offer, preparing an intervention or finding a procedure. Dismiss issues that require missing data or an undocumented decision. For each, identify the reference document and its manager. A voluminous PDF collection is not yet an actionable basis. The scope must be able to be explained to users.
Clean the documents without removing conditions
Remove obsolete duplicates and identify the applicable version. Preserve titles, dates, units, exceptions and links. A tariff with no validity period or a procedure without prerequisites can lead to a misleading response. Keep the origin of each passage so that the interface refers to the document, and not just an impossible to find extract. Also assign a scheduled revision date.
Build an actionable documentary inventory
For a site project, the pilot corpus can be limited to an offer, its contact procedure and public documents that explain its implementation. This scope allows you to check the responses without confusing an information assistant with a tool with access to customer files. The knowledge base should be governed as site content: someone decides what is applicable and what needs to be removed.
| Field | control matter | practical consequence |
|---|---|---|
| ID and version | Can we find the exact document? | Connect each passage to a stable version |
| Authorized audience | Who can view this information? | Apply rights before restitution |
| validity period | Is the rule still applicable? | Remove or revise expired passages |
| Responsible | Who can confirm a contradiction? | Provide validation instead of letting the model choose |
| question covered | What decision does the document allow? | Test the corpus on a real need |
A document can be useful to the team without being adapted to a public assistant. An internal note containing business exceptions does not become publishable because it is technically indexable. Filtering should be used in the application and in the search device, not just in a setpoint asking the model to remain discreet.
Split documents at meaningful boundaries
The Hugging Face guide features a corpus division into passages used for research. There is no universal size. Our practical starting point is to keep a rule, its conditions and its exception together, then to test the real questions. If the recovered passage mixes several products, look for a clearer editorial border instead of arbitrarily increasing the context.
Fictitious example: maintenance documentation
A team has three versions of a backup procedure. It keeps the approved version in the pilot scope, archives old ones out of the current search and designates a manager. The question "Can I restore alone?" must find the required access and validations, rather than an old support message. You can check this wait before choosing the chat interface.
Test cutting with a rule and its exception
Take a fictitious documentation rule: the medium responds during published schedules; A specific service may provide for different conditions. If the division separates the rule from this condition, the system may have too general a response. Keep in each passage the context necessary for its understanding and reference to the complete document. A randomly chosen fragment size does not solve this editorial problem.
- Prepare a simple question whose answer is in a single document, then a question that requires reading a condition or exception. Note the expected passages.
- Inspect what the search has recovered before reading the final answer. An elegant response may mask an insufficient passage or an old version.
- Add an unanswered question in the corpus. The expected result is a limit indication and a way to contact a person, not a plausible invention.
- Test a document deletion or revision. Verify that old passages are not available in index, caches, or reference links.
The Hugging Face RAG guide illustrates several choices of cutting and research; Its settings are not a universal value to be copied. Your acceptance test should decide if the corpus answers your questions. The next step is a Separate evaluation of research and responses, before expanding the chatbot to all pages of the site.
If the corpus contains external pages or received documents, add a Acceptance tests for prompt injection. The control covers the access and possible actions of the application, even when an answer seems to follow the instructions.
Test the right not to answer
Add out-of-perimeter questions and requests that the corpus does not answer. The assistant must recognize the absence and refer to an interlocutor. Control respect for user rights at each step. Plan an update routine and a Verification of generated responses. A limited pilot helps identify documentary gaps without hiding them behind a smooth response.
