In this tutorial, you'll learn how to use chat to converse with your data using AI.
RAG (Retrieval-Augmented Generation) is a technique that combines:
Retrieval: Finds the most relevant information in your data
Augmented Generation: Uses that information as context for AI to generate a response
Result: Accurate answers based on your data, without hallucinations.
Search vs Chat: Which to Use?
AI synthesizes the information
Need to cite exact source
High performance/low latency
AI interprets and responds
Data already ingested in the Knowledge Base
Step 1: Ask a Question
Step 2: Understand the Response
Response Fields
AI-generated answer based on your data
List of sources used to generate the answer
Chunk ID in the vector database
Original excerpt used as context
sources[].snack_elemental_id
Step 3: Use Filters for Specific Context
You can direct chat to search in specific data:
This ensures the AI only uses documents with these tags as context.
Using Streaming for Real-time Chat
For real-time chat interfaces, use the streaming endpoint:
The response comes as Server-Sent Events (SSE):
To implement streaming in the frontend, see the guide Real-time Chat.
Understanding Citations (Sources)
The sources allow you to verify where each piece of information came from:
You can use these IDs to:
Link to the original document in your interface
Show users the source of information
Validate response accuracy
Tips for Better Responses
1. Be Specific in Your Question
2. Use Filters for Context
If you know where the information is, use filters:
3. Comparison Questions Work Well
4. List Questions Work Well
If the AI doesn't find relevant information, it will respond something like:
What to do:
Check if the data was ingested correctly
Try rephrasing the question
Remove overly restrictive filters
Use semantic search to explore available data
Now that you've mastered RAG chat:
Real-time Chat - Implement streaming in the frontend
Filter by Tags - Direct context with precision
Error Handling - Handle errors gracefully
Estimated time: 10 minutes ✅