Summary. Retrieval-augmented generation (RAG) provides Large Language Models with relevant context from a specific knowledge base to improve the accuracy and specificity of responses. I use RAG to ensure that models ground their answers in retrieved data rather than relying on internal memory, which can lead to hallucinations or outdated information.
What the posts say
RAG provides context by finding relevant text before the model generates an answer.
“Retrieval-Augmented Generation, RAG for short, is the pattern behind most of the useful AI applications being built right now: instead of asking a language model to answer purely from what it happened to be trained on, you find the specific, real, relevant text first, hand that to the model as context, and ask it to answer from that.” — Model Context Protocol (Part 3)
The embedding model converts document chunks and questions into lists of numbers representing meaning.
“A: It turns each chunk of a document, and later each question, into a list of numbers that stands for its meaning.” — Azure Search (Part 2)
The embedding model is only used to find passages, while a separate model writes the final answer.
“The agent uses a separate model to write the answer from the passages that the search returns.” — Azure Search (Part 2)
The system provides a provider-agnostic layer that ensures citations are grounded in retrieved data rather than hallucinated by the model.
“This post is the actual build: Phases 1 through 3 of that plan, all of it running locally on my 32GB M4 MacBook Air through Docker Compose, with Ollama serving both the chat model and the embeddings — no cloud API required to get a working system end to end.” — Agentic AI for Professionals (Part 2)
Context injection provides the model with relevant information from a knowledge base.
“Context injection is a technique that involves providing GPT-4 with additional relevant information from your knowledge base alongside the user’s query.” — Context Injection
Context injection improves the accuracy and specificity of the model.
“This helps guide the model’s response and enhances its accuracy, relevance, and specificity.” — Context Injection
The system uses a curated, scoped document set rather than the open web.
“That constraint turned out to be the right one to build around, not a limitation to route past: a curated, scoped document set someone actually put together by hand, then a single RAG-grounded Q&A skill run on top of it.” — Agentic AI for Professionals (Part 1)
The system ensures citations are accurate because the metadata is pulled from the database rather than generated by the LLM.
“The detail I think matters most here: citation metadata — case name, medium-neutral citation, page number — is read straight off the retrieved database rows, never generated by the model.” — Agentic AI for Professionals (Part 2)
The posts behind this page
- Azure Foundry Agent (Part 6) — Rules from the statutes, a small model that only reads, and a side-by-side test against GPT, DeepSeek and Google on the same arrests
- Azure Foundry Agent (Part 5) — Following Microsoft's Foundry IQ learning module with my six Minnesota law documents: a knowledge base, an agent with vague versus strict instructions, 17 questions, and a comparison with my other RAG posts
- Model Context Protocol (Part 3) — Building a Retrieval-Augmented Generation stack and finally exposing the search function to Claude Code over MCP
- Agentic AI for Professionals (Part 3) — Giving nsw-legal-research-assistant a real interface and an MCP server exposing the same skill to Claude Code, then running it through the same demo Thomson Reuters used to introduce CoCounsel, live, with real output — grounded Q&A, pinpoint citations, Review, and skill-chaining drafting
- Agentic AI for Professionals (Part 1) — Using a structured LLM-wiki research process to study Thomson Reuters CoCounsel's architecture, then turning that research into an implementation plan for a simplified legal research assistant
- Agentic AI for Professionals (Part 2) — Building the RAG core of a legal research assistant entirely on a 32GB M4 MacBook Air — page-safe chunking, a provider-agnostic LLM layer, and citations that can't be hallucinated
- Azure Search (Part 2) — Creating an AI agent in Azure AI Foundry backed by Azure AI Search with vector embeddings for retrieval-augmented generation (RAG)
- LangChain (RAG) — Using LangChain to create a medical report application
- Context Injection — How context injection works in LLM applications — injecting relevant documents, data, and instructions into the model's prompt at runtime for RAG