Skip to content
All Stories
2025-12-09•8 min read

Document Processing · PDF · RAG · Retrieval · Pixeltable · LLM · Embeddings · OCR · Text Extraction · Knowledge Base

Build Production Document RAG Pipelines with Pixeltable

Learn how to build end-to-end document processing pipelines that extract, chunk, embed, and search PDFs and documents using Pixeltable's declarative approach, with no external orchestration needed.

Pixeltable Team

Pixeltable Team

Pixeltable Team

View as Markdown

The Document Processing Challenge#

Building a document RAG (Retrieval-Augmented Generation) system sounds simple: extract text from PDFs, chunk it, embed it, and search. But production reality is messier:

  • PDFs have tables, images, headers, and footers that need special handling
  • Documents get updated and need re-processing
  • You need to track which chunks came from which documents
  • Embeddings need to stay in sync when documents change
  • The pipeline needs to scale to thousands of documents

Pixeltable solves all of this with a declarative approach that handles extraction, chunking, embedding, and search in a single unified system.

Basic Document Pipeline#

Let's start with a simple but complete document processing pipeline. The application file declares a table for the documents and a view that splits them into chunks:

python

Create the tables:

bash

Then insert documents and search them from Python:

python

Advanced: Handling Complex PDFs#

Real PDFs have tables, images, and complex layouts. Splitting a PDF by page keeps each page's extracted text next to an image of that page, and an LLM can clean up the text. The OpenAI columns from here on need pip install openai and OPENAI_API_KEY in the environment before the first pxt command, since the pxt daemon reads its environment once when it starts:

python

Smart Chunking Strategies#

Different documents need different chunking strategies. A view's base can be a filtered query, so each document type gets its own splitter:

python

Enriching Chunks with Metadata#

Add useful metadata to each chunk for better retrieval. Replace the Chunks class in app.py with this version and run pxt schema update app.py docs again. The update adds the new columns and the summary index, and computes them for the chunks already stored:

python

Search the summaries with app.Chunks.summary.similarity(string=query), or the text as before.

Complete RAG Pipeline with LLM#

Here's a full RAG system that retrieves relevant chunks and generates answers. Retrieval is a @pxt.query used as a computed column, so each question keeps the context its answer came from:

python

Run pxt schema update app.py docs, then ask questions. Retrieval and generation run on insert:

python

Handling Document Updates#

When a document changes, Pixeltable's incremental processing regenerates that document's chunks and recomputes their columns and index entries. Chunks of other documents stay as they are:

python

Scaling to Large Document Libraries#

Tips for handling thousands of documents:

python

Why Pixeltable vs Traditional RAG Stacks#

TaskTraditional StackPixeltable
Text extractionPyPDF2, pdfplumber, unstructureddocument_splitter: text, page images, headings, page numbers
ChunkingLangChain, custom codeBuilt-in document_splitter iterator
EmbeddingsSeparate embedding serviceComputed column, stored with each chunk
Vector storePinecone, Weaviate, pgvectorBuilt-in embedding index
OrchestrationAirflow, Prefect, customAutomatic with dependencies
UpdatesManual re-indexingNew, updated and deleted documents update their chunks and index on write
LineageExternal trackingBuilt-in versioning

Conclusion#

Building production document RAG systems doesn't have to be complex. With Pixeltable's declarative approach:

  • Define your pipeline as computed columns
  • Let Pixeltable handle extraction, chunking, and embedding
  • Insert, update or delete a document, and its chunks, columns and index entries follow
  • Scale from prototypes to production without changing code

The best part? Your entire document pipeline (from raw PDFs to searchable embeddings) lives in one place, fully versioned and queryable.

The class-based TableModel receipt for the same job is DocuVision.

Resources#

Declarative. Multimodal. Incremental.

One Python file for tables, indexes, and HTTP. Start locally, or sign up for Cloud.

Get started

Docs quickstart · 10-minute tutorial · GitHub · Discord