Documentation Index
Fetch the complete documentation index at: https://mintlify.com/StarTrail-org/PixelRAG/llms.txt
Use this file to discover all available pages before exploring further.
pixelrag is the umbrella CLI that dispatches to each pipeline stage. Each stage is a subcommand backed by an independently installable package; install the relevant extra to enable it. Stage 0 (rendering pages to screenshot tiles) is handled by the standalone pixelshot command, not a subcommand here.
Synopsis
Stages
| Stage | Description | Requires extra |
|---|---|---|
chunk | Split 8192 px tiles into 1024 px chunks | embed |
embed | Embed tile shards with Qwen3-VL | embed |
build-index | Merge embeddings into a FAISS or Qdrant index | embed |
index | Run the full pipeline: source → render → chunk → embed → index | index |
monitor | Monitor pipeline progress | index |
serve | Start the FastAPI search server | serve |
pixelrag chunk
Pre-chunks tile images into 1024 px strips on disk. For each*.png.tiles/ directory, it reads every tile_XXXX.jpg and splits it into chunk_XXXX_YY.png files, then writes a chunks.json manifest. Requires the embed extra.
Process all shard directories found under this path. Mutually exclusive with
--shard-dir. Use this for batch operations over a full tiles output
directory.Process a single shard directory. Mutually exclusive with
--tiles-dir.Exactly one of
--tiles-dir or --shard-dir is required.Number of parallel shard worker processes when using
--tiles-dir.Rechunk even when
chunks.json already exists. Compares tile MD5 hashes
against the stored values and skips unchanged tiles, so this is safe to run
incrementally.Delete the original
tile_*.jpg files after each shard is chunked. Saves
significant disk space when tiles are no longer needed for re-rendering.Count chunks without writing any files to disk. Useful for estimating output
size before committing.
Example
pixelrag embed
Embeds tile shards using Qwen3-VL-Embedding-2B and writes per-shard.npz files. Requires the embed extra.
Path to the input shard directory containing
*.png.tiles/ subdirectories.Directory where the output shard
.npz embedding files are written.Comma-separated GPU IDs to use, or
all to use every visible GPU. For
example: 0,1,2,3.Number of images passed to the embedding model per call.
Inference backend for embedding.
| Value | Description |
|---|---|
sglang | SGLang engine — recommended for GPU, highest throughput |
vllm | vLLM pooling engine |
direct_gpu | Direct Transformers inference; required for --adapter |
Embedding granularity.
| Value | Description |
|---|---|
chunks | Embed pre-chunked 1024 px strips (default, ~8× fewer tokens per tile) |
tiles | Embed full 8192 px tiles |
Example
pixelrag build-index
Merges all shard.npz embedding files, deduplicates vectors, and builds a FAISS or Qdrant vector index. Requires the embed extra.
Directory containing the shard
.npz files produced by pixelrag embed.Output directory where index files and
summary.json are written.Number of IVF clusters for the FAISS index. A good starting point is
n_vectors / 40. The pipeline auto-tunes this when called from
pixelrag index build.Default search nprobe stored in the index. Higher values increase recall at
the cost of query latency.
Vector index backend.Choices:
faiss, qdrantQdrant server or Cloud URL. Required when
--backend qdrant.Qdrant collection name.
Upsert into an existing Qdrant collection rather than failing. Mutually
exclusive with
--recreate.Delete and recreate the Qdrant collection before uploading. Mutually
exclusive with
--append.Path to a JSON file containing a Qdrant
quantization_config object. Applied
when creating a new or recreated collection.Example
pixelrag index
The full-pipeline orchestrator. Readspixelrag.yaml, then runs all four stages in order: source ingestion → render (via pixelshot) → chunk → embed → build index. Requires the index extra.
Sub-command to run. Currently
build is the only supported command.Path to a
pixelrag.yaml configuration file. When omitted, the pipeline
searches the current directory and common parent directories for
pixelrag.yaml. Short form: -c.Process only the first N documents from the source. Useful for smoke-testing
a configuration before committing to a full index build. Short form:
-n.Delete existing tiles and embeddings and rebuild from scratch. Without this
flag, the pipeline skips documents whose tile directories already exist and
whose source identity hasn’t changed. Short form:
-f.pixelrag serve
Starts the FastAPI search server backed by a pre-built FAISS or Qdrant index. Requires theserve extra.
Directory containing
index.faiss (or summary.json for Qdrant) and
metadata.npz. Overrides the PIXELRAG_INDEX_DIR environment variable.Directory of rendered tile images, served at
/tile/{article_id}/{tile_index}/{chunk_index}.
Overrides the PIXELRAG_TILES_DIR environment variable.Path to the
articles.json mapping file produced by pixelrag index build.
Overrides the PIXELRAG_ARTICLES_JSON environment variable.HuggingFace model name or local path for query embedding. Must match the
model used during
pixelrag embed.Device for query embedding inference.Choices:
cpu, cudaPath to a PEFT/LoRA adapter directory. The adapter is merged into the base
model weights at startup via
merge_and_unload, so inference runs at
base-model speed.Host address for the uvicorn server.
Port for the uvicorn server.
Vector backend override. When omitted, the backend is read from
summary.json in --index-dir, falling back to faiss.Choices: faiss, qdrantQdrant server or Cloud URL. Required when using the Qdrant backend.
Qdrant API key. Can also be set via the
QDRANT_API_KEY environment
variable.Path to a JSON file containing
QdrantClient constructor arguments.
Merged with --qdrant-url and --qdrant-api-key.Qdrant collection name. When omitted, the value from
summary.json is used,
falling back to pixelrag.Render tile images on the fly from a running kiwix-serve instance instead of
reading a pre-materialized
tiles/ directory. Only pages that are actually
retrieved get rendered and cached locally.Base URL of a running kiwix-serve, used when
--render-on-demand is set.
Overrides the PIXELRAG_KIWIX_URL environment variable.kiwix book ID for
/content/<book>/ URL construction (e.g.
wikipedia_en_all_maxi_2024-01). Auto-derived from the kiwix catalog when
omitted. Overrides the PIXELRAG_ZIM_BOOK environment variable.Install Hints
If you run a stage whose package is not installed,pixelrag prints the exact install command and exits with code 1:
Which extra installs which stage?
Which extra installs which stage?
| pip extra | Stages enabled |
|---|---|
| (none, base install) | pixelshot command only |
embed | chunk, embed, build-index |
index | index, monitor |
serve | serve |