456
Dictionary

RAG (Retrieval-Augmented Generation)

Inject external knowledge into an LLM at query time.

2 min readupdated 2026-06-17

/ quick answer

Retrieval-Augmented Generation is a pattern where relevant documents are retrieved from a vector store and inserted into the model's context before generation, grounding answers in source material. Inject external knowledge into an LLM at query time.

Retrieval-Augmented Generation (RAG) is the pattern of grounding an LLM's answer in documents fetched at query time instead of relying only on what the model memorised during training. A RAG system turns your knowledge base into embeddings, stores them in a vector database, and at question time retrieves the most relevant chunks to inject into the prompt. This gives the model fresh, private, citable information — customer docs, internal wikis, product data — without expensive fine-tuning and without the hallucinations that come from asking a model about things it never saw. RAG is the default architecture for AI assistants, support bots, internal search and any use case where accuracy and provenance matter more than raw creativity. In 2026 the state of the art has evolved into hybrid retrieval (vector + keyword), reranking, and agentic RAG where the model plans its own multi-step searches.
Definition
Retrieval-Augmented Generation is a pattern where relevant documents are retrieved from a vector store and inserted into the model's context before generation, grounding answers in source material.
Example
A support bot retrieves the 3 most relevant help-center articles for a user question and asks the LLM to answer using only those sources.
Related Workflows
Related Tool Stacks
Related Prompts
/ frequently asked

What does RAG stand for?

Retrieval-Augmented Generation. The model retrieves relevant documents at query time and generates an answer grounded in them.

When should I use RAG instead of fine-tuning?

Use RAG for factual, changing or private knowledge — docs, tickets, product data. Use fine-tuning for consistent style, format or a narrow behaviour that prompting cannot reach.

Do I always need a vector database for RAG?

No. For small corpora, in-memory search or keyword search (BM25) can outperform a naive vector setup. Vector DBs shine when you have thousands+ documents and need semantic recall.

How does RAG reduce hallucinations?

By passing the retrieved passages into the prompt and asking the model to answer only from them (with citations), the surface area for fabrication drops sharply — though prompt design and reranking still matter.

↳ connected nodes
Workflow↳ linked
Build an Internal Knowledge Bot
Ship a Slack bot that answers questions from your company docs.
Workflow↳ linked
AI Customer Onboarding Flow
Walk every new user through activation with an AI guide.
Tool Stack↳ linked
RAG Starter Stack
Minimum viable stack to ship a production RAG chatbot.
Prompt↳ linked
Grounded Answer Prompt
Force the model to answer only from provided sources, with citations.
Workflow↳ linked
RAG Content Ingestion Pipeline
Convert messy docs into searchable, cited knowledge chunks for AI systems.
Workflow↳ linked
Personal Research Assistant Workflow
A repeatable system to research any topic deeply in under 30 minutes.
Workflow↳ linked
Build a Tier-1 Customer Support Agent
An agent that handles common tickets end-to-end and hands off the rest.
Workflow↳ linked
Build an MCP Server for Your Internal Data
Expose one internal data source to every AI client via the Model Context Protocol.
Workflow↳ linked
Dynamic Context Insertion Workflow
This workflow details how to dynamically inject context-specific information into LLM prompts based on user queries or application state, improving response accuracy and relevance.
Tool Stack↳ linked
RAG Context Enrichment Stack
A technical stack designed to enrich the contextual data provided to a Retrieval Augmented Generation (RAG) system, improving the quality and depth of LLM responses.
Workflow↳ linked
Build AI Voice Agent Customer Support
This workflow outlines the steps to develop and deploy an AI voice agent for automated customer support interactions, from intent recognition to natural language response generation. It aims to reduce agent workload and improve response times for common queries.
Workflow↳ linked
Reduce Agent Context Window Costs
This workflow details methods to minimize the token count within an AI agent's context window, directly reducing LLM API costs.
Tool Stack↳ linked
Low-Cost RAG Stack
This stack combines open-source and cost-efficient components to build a Retrieval-Augmented Generation (RAG) system with minimized operational expenses.
Tool Stack↳ linked
Multi-Agent Orchestration Stack (CrewAI)
This stack outlines the essential components for deploying a robust multi-agent system using CrewAI, focusing on agent definition, tool integration, and monitoring for collaborative task execution.