Bonus: Retrieval Augmented Generation (RAG)
To further learn how to provide context to your prompts, this bonus section demonstrates how to use RAG.
What is RAG?
RAG (Retrieval Augmented Generation) is a technique that:
- Retrieves relevant information from your data sources
- Augments the AI prompt with this context
- Generates a response grounded in real data
This solves the hallucination problem by ensuring the AI has access to current, accurate information at query time.
RAG adds a retrieval path between the question and the model so answers can be grounded in current source material.
How RAG Works in Kestra
The Process:
- Ingest documents: Load documentation, release notes, or other data sources
- Create embeddings: Convert text into vector representations using an LLM
- Store embeddings: Save vectors in Kestra's KV Store (or a vector database)
- Query with context: When you ask a question, retrieve relevant embeddings and include them in the prompt
- Generate response: The LLM has real context and provides accurate answers
Exercise: Retrieval With vs Without Context
Objective: Understand how RAG eliminates hallucinations by grounding LLM responses in real data.
Part A: Without RAG
- Navigate to the
10_chat_without_rag.yamlflow in your Kestra UI - Click Execute
- Wait for the execution to complete
- Open the Logs tab
- Read the output - notice how the response about "Kestra 1.1 features" is:
- Vague or generic
- Potentially incorrect
- Missing specific details
- Based only on the model's training data (which may be outdated)
Part B: With RAG
- Navigate to the
11_chat_with_rag.yamlflow - Click Execute
- Watch the execution:
- First task: Ingests Kestra 1.1 release documentation, creates embeddings and stores them
- Second task: Prompts LLM with context retrieved from stored embeddings
- Open the Logs tab
- Compare this output with the previous one - notice how it's:
- ✅ Specific and detailed
- ✅ Accurate with real features from the release
- ✅ Grounded in actual documentation
Key Learning: RAG (Retrieval Augmented Generation) grounds AI responses in current documentation, eliminating hallucinations and providing accurate, context-aware answers.
RAG Best Practices
- Keep documents updated: Regularly re-ingest to ensure current information
- Chunk appropriately: Break large documents into meaningful chunks
- Test retrieval quality: Verify that the right documents are retrieved
Additional AI Resources
Kestra Documentation:
- AI Tools Overview
- AI Copilot
- RAG Workflows
- AI Workflows
- Kestra Blueprints - Pre-built workflow examples
Kestra Plugin Documentation:
External Documentation: