Look up terms and abbreviations in the glossary

RAG: from documents to useful knowledge

RAG should make company knowledge useful in everyday work. Start with a specific question, reliable sources, and a measurable improvement. Expand when results demonstrate value.

A language model can produce a convincing answer without knowing your latest product terms, decisions, or workflows. Retrieval-augmented generation (RAG) connects the model to relevant information retrieved when a question is asked. This makes answers easier to check, but it guarantees neither correct sources nor correct conclusions. [1, 2]

1. How RAG works

RAG combines retrieval and generation. A document repository holds the originals. A retrieval layer finds relevant excerpts or data. A large language model (LLM) uses that material as context to answer the question. Changing a document normally does not require retraining the language model itself. [1, 7]

  • Prepare knowledge: Select sources, extract text and tables, and divide the content into meaningful sections, often called chunks. Preserve headings, document IDs, versions, and access information.
  • Make content searchable: an embedding model converts text into numerical vectors that help identify content with related meanings. Keyword and full-text search also find exact names, technical terms, and product numbers. Combining these approaches is called hybrid search. [1, 2]
  • Find and select: Interpret the question, check the user’s access, and retrieve relevant results. A reranker can then assess which results best answer that specific question. More excerpts are not always better. [2]
  • Answer and show the evidence: Send the selected information to the model and cite the document, section, and version. If the evidence is insufficient or conflicting, explain the limitation or ask for clarification.

An illustrative example: An employee asks whether a customer can exchange a particular item. RAG finds the current return policy. An approved database query retrieves the purchase date and item type. The model explains how the policy applies and cites both sources. Any actual exchange is a separate action requiring its own permissions.

Value should be visible in the work

Measure factors such as time from question to reviewed answer, errors, and rework. Freed time becomes business value only when it is put to use. A shared, maintained knowledge base may also make training and future AI initiatives easier. That is potential indirect value that must be verified.

For a few short documents, direct attachment may be sufficient. RAG becomes especially relevant when the volume of knowledge, rate of change, or access requirements make selective context necessary. We recommend testing the simplest solution that can meet the need. [2]

2. RAG in four AI environments

Distinguish a ready-made assistant from a solution built through an API. An assistant makes getting started easier. A custom solution gives you more control over sources, access, search, and evaluation, but requires development and operations. Features and limits depend on the product, plan, and configuration.

Microsoft: From workplace knowledge to custom solutions

Microsoft 365 Copilot can use organizational knowledge. Microsoft’s Retrieval API lets custom applications retrieve relevant excerpts from SharePoint, OneDrive, and Copilot connectors while respecting user access and governance rules. This can reduce the need for a separate index of the same content. The access method determines available sources and licensing terms. [3]

Copilot Studio is used to build agents with selected knowledge sources, such as SharePoint, Dataverse, files, and external systems. Check each connection’s security model: delegated SharePoint access and a connection to an Azure AI Search index do not automatically provide the same filtering by user permissions. [4]

For more specialized needs, Azure AI Search can be combined with models and applications in Microsoft Foundry. This allows control over hybrid search, ranking, and multiple data sources. Agentic retrieval can split complex questions into subqueries. Choose it when the additional searches demonstrate a quality benefit. [5]

ChatGPT and OpenAI: Project context or custom RAG

ChatGPT Projects can bring together files, instructions, and connected sources across conversations. Available apps and plugins can connect to other systems. This is a practical way to start working with shared material; a project does not by itself implement your document approval and versioning rules. [6]

For a custom application, OpenAI offers File Search in the Responses API. Uploaded files are organized in vector stores and searched using semantic and keyword search. You can also retrieve context through your own search layer and supply it to the model. The application must ensure that only authorized content is selected. ChatGPT files and API stores are separate configurations. [7]

Claude: Project knowledge and external search results

On supported paid plans, Claude Projects can search project documents. RAG activates automatically as project knowledge approaches or exceeds the context window limit. This makes larger document collections usable without including every document in every request. [8]

In the Claude API, a custom search function can return search_result blocks containing content, a title, and a source that Claude can cite. Anthropic also describes Contextual Retrieval, which adds brief explanations of a passage’s context before indexing. It can improve retrieval, but should be tested on your own documents. [9, 2]

Gemini: A managed approach to a document pilot

Gemini API File Search handles importing, chunking, embeddings, and search in a File Search Store, and can return citations. It is one option for an initial document pilot. Google Docs and Drive can remain the home of the originals; importing into File Search does not automatically synchronize subsequent changes or permissions. That requires a separate process. [10]

3. Shared knowledge, multiple models, and data sources

GPT, Claude, and Gemini can use the same authorized knowledge through a shared retrieval layer. An API or Model Context Protocol (MCP) connection can expose search to multiple assistants. This requires specific integrations; models do not automatically gain access to one another’s project files or provider-specific search stores.

One possible design has one model clarify the question, a retrieval layer choose document, SQL, or graph queries, and another model formulate the answer. A third could check whether sources support key claims. This is an architectural proposal. Agreement among models is not proof of correctness, and model-based review replaces neither access controls nor subject-matter judgment. [9, 14]

Keep sources, permissions, and version rules shared while allowing models to change according to task, quality, latency, and price. Preserve source information throughout the process. Every model provider receiving excerpts participates in data processing. Start with one answer model and add others only when measurements justify the complexity.

Choose lookups to fit the question

Data source: Documents and files

Useful for: Terms, instructions, decisions, and explanations.

What the solution must handle: Semantic and exact search; the current version, headings, table structure, and source link.

Data source: Relational and SQL databases

Useful for: Current orders, inventory, and calculations across records.

What the solution must handle: Approved queries, shared definitions, row-level access, and query timestamps. [11]

Data source: Graphs and GraphRAG

Useful for: Relationships among customers, products, systems, and dependencies.

What the solution must handle: Unambiguous identities, relationship direction and validity, and traceability to evidence. [12]

Data source: APIs and other systems

Useful for: Current status from systems such as CRM, support platforms, and external registries.

What the solution must handle: Access, update frequency, latency, and a clear response when the source is unavailable.

SQL can provide structured results to a model and, with appropriate capabilities, support text and vector search. For “What are our total sales?”, the database should calculate the sum across the correct records. A selection of similar text passages is not a complete basis for calculation. Agree on boundaries such as currency, returns, and reporting period. [11]

Natural-language-to-SQL needs more than a prompt: use restricted read permissions, permitted tables or views, validated queries, parameterized values, and limits on execution time and result size. Parameterizing a value does not make arbitrary model-generated SQL safe. [14, 16]

A knowledge graph can follow relationships across multiple steps. Microsoft’s GraphRAG derives a graph and community summaries from text, which can help reveal connections and broader themes. Inferred relationships can be wrong and need review. Assess maintenance and computing costs before building the graph. Microsoft Graph—the access interface for Microsoft 365—is a different concept from a standalone knowledge graph. [3, 12]

4 Security and data quality span the entire chain

RAG makes information easier to find. That makes overly broad permissions and poorly maintained documents more visible and more consequential. Security must work from the source system through the search index, model, answer, cache, and logs.

Enforce access outside the model

Identify the user and check organization, role, and document access before sending information to a model. Use least privilege and clear separation between companies’ data. Retrieving confidential documents and then instructing the model not to reveal them is insufficient. Source links must also respect access controls. [13]

Test permission changes and deletions. They must propagate to search and derived copies within an agreed timeframe; reject retrieval when access is uncertain. For example, Microsoft describes a preview SharePoint ACL integration in Azure AI Search that requires affected documents to be reindexed after permission changes. A connector alone is therefore not evidence that access remains correct over time. [13]

Documents can contain attacks

Prompt injection occurs when text in a document or other input tries to make the model follow instructions, reveal information, or misuse tools. Treat retrieved material as data. Restrict tools, validate their inputs, and check outputs. Separate reading from actions and apply appropriate controls to consequential actions. No single prompt or additional review model removes the risk. [14]

Choose data processing arrangements based on the specific service and agreement: what goes where, what is stored, who has access, and whether content may be used for training. Clarify regions, retention, deletion, and subprocessors. Encryption alone does not answer these questions. Minimize personal information and secrets in both context and error reports. These are requirements to resolve for the solution, not properties guaranteed by the term RAG.

Sources must be maintainable and understandable

We recommend one canonical original per document and language, with a stable ID, owner, status, version, validity period, and next review date. Record topics, source links, and access classification. An approved text copy can preserve the exact version supporting an answer. The search index should be rebuildable from originals and approved copies.

Check text extraction, especially from scanned PDFs, tables, and images. Preserve units, column headings, exceptions, and context: “must not” must not become “may,” and a price without a currency is insufficient. Remove duplicates and establish which source governs when instructions conflict. Translations must be traceable to the original version.

Index only one chosen text format of the same content version. DOCX and mobile PDFs are reading formats, not additional knowledge sources. The import process must record checksums and results, update changed content, and remove withdrawn material. At EnableAI, drafts stay out of production retrieval until content, rights, and access have been resolved.

5. Improve quality with machine learning and feedback

Machine learning can improve embedding models, ranking, and source selection. AI can suggest metadata, detect duplicates, and add explanatory context to chunks. Review those suggestions; an automatic summary can propagate an error. RAG does not automatically learn from usage. Adding documents, changing retrieval settings, and training a model are different changes. [2]

Create a test set of real questions, expected sources, and answers assessed by subject-matter experts. Include US English wording, supported multilingual queries, unanswerable questions, and unauthorized access attempts. Hold back a separate set for final evaluation. Measure whether retrieval finds the right sources and whether answers are relevant, complete, and supported. Also measure latency, cost, and user rework. An LLM can help assess results, but human spot checks must validate its judgments. [15]

Use errors and user feedback to choose one improvement at a time: correct a source, adjust chunking, add synonyms, or test a reranker. Training a ranking model requires validated relevance judgments; clicks and satisfaction are only signals. Compare on the same test set before release and keep a rollback path. When changing embedding models, the index and queries must use compatible vector spaces, usually requiring reindexing. Monitor outdated content and new questions. Agree in advance on release-blocking errors and how often a content owner reviews results.

Develop RAG through the three stages

Experiment: Test one workflow and its key questions using a few quality-checked documents. MVP: Connect real users with access controls, citations, feedback, and measurable expected value. Scaling: Expand only when quality and impact hold; add synchronization, operational ownership, and data sources as needed. This is EnableAI’s recommended approach. Short feedback cycles should produce documented learning and a justified next investment.

A customer example with goals and follow-up

The internal knowledge assistant in the service example should support 4,000 monthly cases. The target is three minutes less total work per case, including source checks and corrections. Select questions with valid answers, conflicting versions, and insufficient evidence.

If the assistant answers quickly but employees must check outdated return policies, the gain can disappear. Track correct sources and versions alongside time per completed case. A possible future customer portal is indirect value requiring its own test.

Use the complete VP/SE model, the VP guide and the SE guide. Reassess both estimates before Hypothesis, MVP, and Scaling. VP/SE is a local preference index, not financial ROI or WSJF. Learn to apply it in half-day session 1 on VP and half-day workshop 2 on SE and prioritization, each four hours long, including a break.

Sources and further reading

Product descriptions draw on the primary sources below. Examples, architecture choices, and development stages reflect EnableAI’s professional judgment.

[1] OpenAI · Retrieval

[2] Anthropic · Contextual Retrieval

[3] Microsoft · Microsoft 365 Copilot Retrieval API

[4] Microsoft · RAG in Copilot Studio

[5] Microsoft · RAG in Azure AI Search

[6] OpenAI · Projects and chats

[7] OpenAI · File search

[8] Anthropic · RAG for projects

[9] Anthropic · Search results

[10] Google · Gemini API File search

[11] Microsoft · SQL Server and AI

[12] Microsoft · GraphRAG

[13] Microsoft · Security best practices for Azure AI Search

[14] OWASP · LLM Prompt Injection Prevention

[15] Microsoft · RAG evaluators

[16] OWASP · SQL Injection Prevention