RAG Development: Building AI on Your Own Company Knowledge
RAG, short for retrieval-augmented generation, lets an AI answer questions using your own company knowledge: it searches your documents for relevant passages and gives them to the language model together with the question. The result is answers grounded in your content, with sources users can check, without training a custom model.
Building a basic RAG demo is easy. Building one that answers correctly on messy real-world documents, respects access rights and stays accurate as content changes is where most of the work lies. This article walks through the components, the typical failure points and how to measure quality.
How does a RAG system work?
Every RAG system has two pipelines. The ingestion pipeline prepares your knowledge in advance. The query pipeline runs every time someone asks a question.
- Collect content from sources such as wikis, help centers, PDFs, ticket histories or databases.
- Clean and split it into meaningful chunks, keeping titles, dates and metadata.
- Create embeddings and store them in a search index, often combined with classic keyword search.
- At query time, rewrite or expand the user's question if needed and search for relevant chunks.
- Rerank and filter results, including by the user's access rights.
- Give the best chunks to the model with instructions to answer only from them and cite sources.
- Show the answer with source links, and log the interaction for evaluation.
Content quality matters more than the vector database
Teams often spend weeks comparing vector databases and embedding models, then discover the real problem is the content. If your documentation contradicts itself, is outdated or lives in scanned PDFs with tables, no retrieval technique will fix that.
As a rule of thumb, budget as much attention for content preparation as for the technical pipeline. The upside: cleaning knowledge for AI usually improves it for human readers too.
- Remove or archive outdated versions so the AI does not retrieve old policies.
- Add clear titles and dates to documents; they become valuable metadata.
- Convert tables and diagrams into text the system can understand.
- Resolve contradictions between sources, or mark which one is authoritative.
- Assign an owner to each knowledge area who keeps it current.
Common RAG failure modes
When a RAG answer is wrong, the cause is usually in retrieval, not in the model. Diagnosing which step failed is the key skill, which is why logging what was retrieved for every question is essential.
- Wrong chunks retrieved: the question uses different words than the documents. Hybrid keyword plus semantic search and query rewriting help.
- Right document, wrong part: chunks are too small or split mid-thought, losing context.
- Stale answers: the index is not updated when content changes.
- Answering beyond the sources: the model fills gaps with plausible guesses. Stronger instructions and an explicit not-found answer help.
- Access leaks: users see content from documents they should not have access to, because permissions were not applied at retrieval time.
- Prompt injection via documents: a document contains instructions that manipulate the model; treat retrieved text as untrusted.
Want an expert opinion on your product?
Talk to a UX expert or AI Code Engineer — 30 minutes, free, no obligation.
Book a call for freeHow to evaluate a RAG system
Gut feeling from a few test questions is not enough. Build an evaluation set of real questions, ideally taken from support tickets, internal chats or search logs, together with the correct answer and the document that contains it.
Then measure two things separately: did retrieval find the right source, and did the model answer correctly and faithfully from it? Separating these tells you where to invest. Rerun the evaluation after every change to chunking, prompts, models or content, and add new failing questions you discover in production.
UX patterns for knowledge assistants
A technically solid RAG system can still disappoint if the interface hides its strengths. Users need to understand where answers come from and what to do when the answer is incomplete. These patterns consistently help in UX reviews of knowledge assistants, and more are covered in our guide to agent transparency and explainability.
- Show sources inline, with direct links to the exact section, not just the document.
- Display the date of the source when freshness matters, such as policies or prices.
- Say clearly when no relevant information was found instead of guessing.
- Let users narrow the scope, for example by product, region or department.
- Offer a quick way to flag wrong answers, routed to the content owner.
Privacy, compliance and getting started
RAG often touches internal documents with personal data, contracts or confidential information. Decide which sources are in scope, apply permissions at retrieval time, check where embeddings and model calls are processed and how long logs are kept. If the assistant faces the public in the EU, AI Act transparency obligations from 2 August 2026 apply; verify the current timeline as late-2025 omnibus proposals may shift parts. This is not legal advice.
UXreviewer.io's team builds RAG-based assistants and AI chatbots, and can add them to existing products as part of LLM integration work. jocapps GmbH is ISO 27001 certified, which shapes how we handle sensitive knowledge. Book a call for free to talk about your knowledge sources.
Frequently asked questions
Is RAG better than fine-tuning a model?
For answering questions from company knowledge, RAG is usually the better starting point: it is cheaper, updates instantly when content changes and can cite sources. Fine-tuning is more useful for teaching style or format than facts.
Can RAG work with PDFs and scanned documents?
Yes, but they need preprocessing. Text PDFs are straightforward; scanned documents need text recognition, and tables or diagrams often need special handling to remain understandable.
How do we handle documents that only some employees may see?
Store access information as metadata and filter results by the user's permissions before anything reaches the model. Never rely on instructions to the model to keep content secret.
How often should the knowledge index be updated?
As often as the content changes in ways that matter. Many teams update on every content change or on a daily schedule, plus a full rebuild after major restructuring.
Book a call for free
From UX audits and Agentic UX reviews to AI development, agentic coding workshops and publishing your AI-built app on the App Store and Google Play — we help you ship. 24/7 call support in English and German.