---
title: "Document Indexing and RAG"
description: "In this tutorial, we'll demonstrate how RAG operations can be implemented in Pixeltable. In particular, we'll develop a RAG application that summarizes a collection of PDF documents and uses ChatGPT to answer questions about them."
url: "https://www.pixeltable.com/notebooks/rag-demo"
updated: "2026-10-30"
---

# Document Indexing and RAG

In this tutorial, we'll demonstrate how RAG operations can be implemented in Pixeltable. In particular, we'll develop a RAG application that summarizes a collection of PDF documents and uses ChatGPT to answer questions about them.

- **Type:** Notebook
- **Group:** Agents

## What it covers

- Outline
- Document Indexing
- Querying
- Incremental Updates

## What it uses

- **Install:** `pip install pixeltable sentence-transformers tiktoken openai openpyxl`
- **Environment variables it names:** `OPENAI_API_KEY`
- **Pixeltable calls:** `document.document_splitter()`, `openai.chat_completions()`, `pxt.create_table()`, `pxt.create_view()`, `@pxt.query`, `@pxt.udf`, `insert()`, `add_embedding_index()`, `similarity()`, `add_computed_column()`

## A look at the code

```python
from pixeltable.functions.huggingface import sentence_transformer

chunks_t.add_embedding_index(
    'text',
    embedding=sentence_transformer.using(model_id='intfloat/e5-large-v2'),
)
```

## Open it

- **Open in Colab:** https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/howto/use-cases/rag-demo.ipynb
- **Docs page:** https://docs.pixeltable.com/howto/use-cases/rag-demo
- **Source on GitHub:** https://github.com/pixeltable/pixeltable/blob/release/docs/release/howto/use-cases/rag-demo.ipynb
