Using RAG Context

Link data lakes to your bot, enable retrieval-augmented generation, and understand citations

Overview

Retrieval-Augmented Generation (RAG) allows your bot to reference uploaded documents when answering questions. When RAG is enabled, OpenRails retrieves the most relevant document chunks from linked data lakes and injects them into the LLM prompt as context.

How RAG Works

When you send a message to a RAG-enabled bot, the following process occurs:

Query Embedding

Your message is converted into a vector embedding using the same embedding model used during document ingestion.

Vector Search

The embedding is compared against the vector collection to find the most semantically similar document chunks.

Context Injection

The top matching chunks are injected into the LLM prompt alongside your message, giving the model access to relevant document content.

Response with Citations

The LLM generates a response informed by the retrieved context. Citations appear as inline references linking back to the source documents.

Understanding Citations

When RAG is active, responses may include citation markers (e.g., [1], [2]) that reference specific source documents. Clicking a citation opens the source document at the relevant passage.

Citation Element Description
Inline Reference Numbered markers within the response text
Source Panel Expandable panel below the response showing source documents
Document Link Click to open the original document in the data lake viewer
Chunk Preview Hover to see the exact text passage used as context
Tip: For best RAG results, ensure your documents are well-structured with clear headings and paragraphs. The chunking process works best with logically organized content.
Important: RAG context is limited by the model's context window. If you link many large data lakes, only the most relevant chunks will be included. Consider creating focused data lakes for specific topics.

Next Steps