Expert knowledge for digital decisions
How to Integrate Internal Documents with RAG to an LLM Server?
Short answer
A Controlled Data Path Instead of a File Upload
Retrieval-Augmented Generation, or RAG, connects a language model at runtime with external knowledge. The original RAG approach, published in 2020, combines a retrievable knowledge base with a generative model. For internal documents, a traceable processing chain is required: capture source, extract text, form sections, calculate embeddings, index, retrieve relevant sections, and generate the response with evidence.
Each section should carry metadata: document ID, title, version, language, validity date, client, and allowed roles. Qdrant recommends storing text sections as separate points; paragraph boundaries are a sensible starting point for continuous text, while technical reference works may require smaller units. There is no universally correct section length. It is tested with real questions.
What is Important in the Productive Process
- Ingestion: Only approved formats and versions are accepted. OCR errors, tables, and attachments require their own quality controls.
- Index: Vectors enable similarity search. Systems like pgvector offer exact search as well as HNSW and IVFFlat for accelerated approximate search; more speed may cost recall.
- Retrieval: Filters for client, role, document status, and language are applied server-side before or together with the vector search. The prompt must not replace this control.
- Response: The model receives only the necessary references, names the document and version, and should clearly decline in the absence of evidence. A source list must point to the actually used text passages.
- Maintenance: Deleted or replaced documents are also removed from the index. Changes occur incrementally but remain traceable through logs and checksums.
For acceptance, a fixed question catalog is required. Not only linguistically good answers are measured, but also retrieval hits, permission errors, and correct evidence. A starting value of 3 to 8 retrieved sections is merely a test area; the right number depends on documents, model, and context window.
Key facts
- RAG Fundamentals
- Published in 2020; 6 steps in the operational data path
- Metadata
- Document ID, version, language, client, and roles per section
- Test Area
- 3 to 8 references as a starting point, not as a general standard
Sources
All external claims are backed by traceable sources.-
01
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks Lewis et al. / arXiv
- 02
-
03
pgvector – Open-source vector similarity search for Postgres pgvector Project