---
title: "What is RAG?"
description: "RAG retrieves from your own data, then generates an answer. A vector database is the index, not the whole pipeline."
url: "https://pixeltable.com/learn/what-is-rag"
updated: "2026-09-29"
vertical: "Retrieval"
doc: "https://docs.pixeltable.com/datastore/embedding-index"
---

# What is RAG?

Retrieval-augmented generation answers from a corpus you supply. The model sees retrieved passages, images, or other snippets at question time, not only what it learned in training.

Updated: 2026-09-29


## On this page

- [What it is](https://pixeltable.com/learn/what-is-rag#what-it-is)
- [How it works](https://pixeltable.com/learn/what-is-rag#how-it-works)
- [What it is not](https://pixeltable.com/learn/what-is-rag#what-it-is-not)
- [Comparison](https://pixeltable.com/learn/what-is-rag#comparison)
- [Where Pixeltable fits](https://pixeltable.com/learn/what-is-rag#where-pixeltable-fits)
- [Questions](https://pixeltable.com/learn/what-is-rag#questions)

## What it is {#what-it-is}

A language model will answer even when it has never seen your files. RAG inserts a retrieval step first. You split the corpus into pieces, represent those pieces so similar ones can be found, and pass the best matches to the model along with the question. The answer is supposed to follow those matches.
The corpus does not have to be plain text. The same shape works for PDF pages, video frames, or audio transcripts, as long as each piece can be stored, embedded, and returned with the source it came from.

## How it works {#how-it-works}

Four steps, in order. Skip one and the system still looks like RAG, but it is only a slice of it.

- Store the source. A document, image, or transcript has to remain addressable after you chunk it.
- Split it. A retrieval unit is a passage, a page, or a frame, not the whole file.
- Index the pieces. An embedding model turns each piece into a vector. Similarity search returns the nearest pieces for a question.
- Generate. The model reads the question and the retrieved pieces and writes the answer. If the pieces are wrong, the answer is wrong.

## What it is not {#what-it-is-not}

A vector database is the index in step three. It stores embeddings and finds neighbors. It does not, by itself, split your files, keep those embeddings aligned when a file changes, or call the model. Teams that “add RAG” by standing up only an index still own the chunker, the sync job, and the prompt.
Stuffing an entire folder into the prompt is also not RAG. That is a long context window. It stops working when the corpus is larger than the window, and it does not tell you which passage was used.

## What each piece of a RAG system is responsible for {#comparison}

| Piece | Does | Does not |
| --- | --- | --- |
| Source store | Keeps the original file and its metadata | Rank passages by meaning |
| Chunker | Cuts a file into retrieval units | Answer the question |
| Embedding index | Finds pieces near a query vector | Split files or call the model |
| Generator | Writes an answer from the retrieved pieces | Remember your corpus after the call |

## Where Pixeltable fits {#where-pixeltable-fits}

In Pixeltable the chunks are a view over the source table, and the embedding index is declared on that view. Insert a document and the new chunks are embedded. Change a document and the affected chunks update. A separate vector database is optional, because the index lives on the table. The implementation guide is Production RAG.

```python
import pixeltable as pxt
from pixeltable.functions.document import document_splitter
from pixeltable.functions.huggingface import sentence_transformer

TableModel = pxt.model_base()
text_embed = sentence_transformer.using(model_id='all-MiniLM-L6-v2')

class Docs(TableModel, name='docs'):
    document: pxt.Document

class Chunks(
    TableModel,
    name='chunks',
    base=Docs,
    iterator=document_splitter(document=Docs.document, separators='sentence'),
):
    __indexes__ = [
        pxt.EmbeddingIndex(text, string_embed=text_embed),
    ]

@pxt.query
def search_docs(query: str, limit: int = 5):
    sim = Chunks.text.similarity(string=query)
    return Chunks.order_by(sim, asc=False).limit(limit).select(Chunks.text, sim)
```

## Questions {#questions}

### Do I need a vector database to build RAG? {#faq-1}

You need an embedding index so similar passages can be found. That index can be a separate vector database, or a column index on the same table that holds the passages. The rest of RAG — splitting, staying in sync, and calling the model — is not the vector database.

### What happens when a document changes? {#faq-2}

The chunks that came from it, and their embeddings, have to change too. If those live in another system, something has to copy them. If they are columns on the source, the row update is the sync.

### Is RAG only for text? {#faq-3}

No. The retrieved piece can be a page, a frame, or a transcript. What matters is that the piece is stored, searchable, and shown to the model with a pointer back to the source.

## In the blog

- [What Is a Multimodal Data Table?](https://pixeltable.com/blog/what-is-a-multimodal-data-table)
- [Make Building Multimodal AI Apps Dead Simple: What That Actually Requires](https://pixeltable.com/blog/dead-simple-multimodal-ai-what-it-takes)
- [Build a Multimodal AI App in 4 Steps Without Writing Infrastructure Code](https://pixeltable.com/blog/build-multimodal-ai-app-four-steps)
- [Pixeltable Starter Kit: From Clone to Production AI App in Minutes](https://pixeltable.com/blog/pixeltable-starter-kit-launch)
- [PixelAssist Retrospective: ~2,100 Lines of TypeScript vs. ~40 Lines of Pixeltable](https://pixeltable.com/blog/pixelassist-retrospective-typescript-vs-pixeltable-backend)
- [Why Pixeltable is the Ultimate Agent Harness](https://pixeltable.com/blog/pixeltable-agent-harness)

## Related

- [Production RAG implementation](https://pixeltable.com/use-cases/production-rag-implementation)
- [Embedding index](https://docs.pixeltable.com/datastore/embedding-index)
- [What is a multimodal database?](https://pixeltable.com/learn/what-is-a-multimodal-database)
