ALAgent Lab

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 data

How 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. 1

    Embed the query

    The question is converted into a vector that captures its meaning.

  2. 2

    Search the vector DB

    Every stored chunk is scored by similarity to the query vector.

  3. 3

    Retrieve top matches

    The few highest-scoring chunks are kept; everything else is dropped.

  4. 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

Simulated
Try:

Your Question

Input

A question about the Northwind Cloud knowledge base

Embed Query

Agent

Turns the question into a vector

Vector Search

Retrieval

Scores every chunk against the query and keeps the closest

Grounded Answer

Model

Answers from the retrieved chunks, with citations