- Published
- Author
- Nitturu BabaSystem Analyst
RAG has three key steps:
1️⃣ Retrieval – Fetch relevant context from a vector database.
2️⃣ Augmentation – Inject the retrieved context into the prompt.
3️⃣ Generation – Use an LLM (GPT, Llama, etc.) to produce a fact-based response.
🔹 Step 1: Retrieval – Finding Relevant Information
Before answering a question, the system searches for relevant documents in a vector database.
💬 Example Question: "What is the capital of France?"
🔍 Retrieval Process:
• The system searches for relevant text in a vector database.
• It finds a stored Wikipedia snippet:
📌 Retrieved Context:
🔹 Step 2: Augmentation – Enriching the Prompt with Context
After retrieving relevant information, the system adds it to the prompt.
📌 Final Augmented Prompt:
User Question: "What is the capital of France?"
Retrieved Context: "Paris is the capital of France, known for the Eiffel Tower."
Final Prompt: "Using the provided context, answer: What is the capital of France?"
👉 Why is this useful?
✅ Retrieval ensures AI has up-to-date context instead of relying only on pre-trained data.
✅ Augmentation refines the LLM’s input, making answers more precise.
✅ Reduces hallucinations, ensuring the AI doesn’t generate incorrect facts.
🔹 Step 3: Generation – Producing the Final Answer
Once the AI has retrieved and augmented the prompt, it generates a final response.
💡 Example Output:
"The capital of France is Paris, known for the Eiffel Tower and rich history."
#AI #RAG
1️⃣ Retrieval – Fetch relevant context from a vector database.
2️⃣ Augmentation – Inject the retrieved context into the prompt.
3️⃣ Generation – Use an LLM (GPT, Llama, etc.) to produce a fact-based response.
🔹 Step 1: Retrieval – Finding Relevant Information
Before answering a question, the system searches for relevant documents in a vector database.
💬 Example Question: "What is the capital of France?"
🔍 Retrieval Process:
• The system searches for relevant text in a vector database.
• It finds a stored Wikipedia snippet:
Paris is the capital of France, known for the Eiffel Tower.📌 Retrieved Context:
Paris is the capital of France, known for the Eiffel Tower.🔹 Step 2: Augmentation – Enriching the Prompt with Context
After retrieving relevant information, the system adds it to the prompt.
📌 Final Augmented Prompt:
User Question: "What is the capital of France?"
Retrieved Context: "Paris is the capital of France, known for the Eiffel Tower."
Final Prompt: "Using the provided context, answer: What is the capital of France?"
👉 Why is this useful?
✅ Retrieval ensures AI has up-to-date context instead of relying only on pre-trained data.
✅ Augmentation refines the LLM’s input, making answers more precise.
✅ Reduces hallucinations, ensuring the AI doesn’t generate incorrect facts.
🔹 Step 3: Generation – Producing the Final Answer
Once the AI has retrieved and augmented the prompt, it generates a final response.
💡 Example Output:
"The capital of France is Paris, known for the Eiffel Tower and rich history."
#AI #RAG