RAG
Retrieval Augmented Generation — combining a retrieval system (vector database, search) with LLM generation to ground responses in up-to-date or domain-specific facts.
Syntax
prompt-engineering
1. Embed query -> search vector DB
2. Retrieve top-k documents
3. Inject docs into context + generateExample
prompt-engineering
// RAG pipeline:
1. User asks: "What is our refund policy?"
2. Embed query -> search company knowledge base
3. Retrieve: [refund_policy.txt chunk]
4. Prompt: "Using the context below, answer the question.
Context: {retrieved_chunk}
Question: {user_query}"
5. LLM generates grounded answer