Retrieval-Augmented Generation
RAG
The model answers from your documents by retrieving relevant passages first, then citing them.
Best for questions about private or changing dataHow it works
The RAG pattern
Retrieval-Augmented Generation grounds the model in a knowledge base. The question is turned into a vector, the closest passages are pulled from a vector database, and only those passages are handed to the model as context. The answer cites what it used.
- 1
Embed the query
The question is converted into a vector that captures its meaning.
- 2
Search the vector DB
Every stored chunk is scored by similarity to the query vector.
- 3
Retrieve top matches
The few highest-scoring chunks are kept; everything else is dropped.
- 4
Grounded answer
The model answers using only the retrieved chunks and cites them.
Why it matters
The model can answer questions about data it was never trained on — internal policies, product docs, last week's tickets — and you can trace every answer back to a source. Quality depends entirely on what retrieval finds.
Playground
Run the rag
Your Question
InputA question about the Northwind Cloud knowledge base
Embed Query
AgentTurns the question into a vector
Vector Search
RetrievalScores every chunk against the query and keeps the closest
Grounded Answer
ModelAnswers from the retrieved chunks, with citations