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_embed provides the chunking, embedding, and index-building stages of the PixelRAG pipeline. Each stage can be run independently or together via the pixelrag index build orchestrator. Install it with pip install 'pixelrag[embed]'.
The three CLI entry points correspond to the three stages:
| Command | Stage | Input → Output |
|---|---|---|
pixelrag chunk | Split tiles into 1024 px chunks | tiles/ → tiles/*/chunks.json |
pixelrag embed | Embed chunks with Qwen3-VL | tiles/ → embeddings/*.npz |
pixelrag build-index | Build FAISS or Qdrant index | embeddings/ → index/ |
pixelrag chunk
Split 8192 px tile images into 1024 px chunk strips and writechunks.json manifests alongside the tile files. The chunking stage must run before embedding.
Options
Directory of tile subdirectories (contains
shard_* subdirectories or directly *.png.tiles directories). Mutually exclusive with --shard-dir.Process a single shard directory instead of all shards under
--tiles-dir. Mutually exclusive with --tiles-dir.Number of parallel processes for shard-level parallelism.
Rechunk even if
chunks.json already exists. The stage compares tile MD5 hashes and skips articles whose tiles have not changed.Delete the original
tile_*.png source images from each shard after chunking. Chunk files (chunk_*.png) that are used directly as chunks are preserved. Useful for reclaiming disk space once chunking is complete.Count chunks that would be written without writing any files.
Examples
pixelrag embed
Embed chunk images usingQwen3-VL-Embedding-2B and write .npz shard files. Supports multi-GPU parallelism via the sglang backend (default) or the direct GPU backend.
Options
Input shard directory to embed (e.g.
tiles/shard_042).Directory to write the output
.npz shard file.Comma-separated GPU IDs to use, or
"all" to use every visible GPU. Examples: "0", "0,1,2,3", "all".Number of chunk images per embedding call.
Embedding backend. Options:
"sglang" (recommended for GPU, highest throughput), "vllm", or "direct_gpu" (direct HuggingFace transformers inference; produces embeddings identical to those used by pixelrag serve).Embedding unit:
"chunks" (default, 1024 px strips) or "tiles" (full 8192 px tiles). The chunks mode is strongly recommended — it reduces visual token count approximately 8×.HuggingFace model name or local path.
Examples
NPZ Shard Schema
Each.npz output file contains the following arrays:
| Array | dtype | Shape | Description |
|---|---|---|---|
embeddings | float16 | [N, D] | L2-normalized embedding vectors |
article_ids | int64 | [N] | Document position index |
tile_indices | int32 | [N] | Which 8192 px tile (0-based) |
chunk_indices | int32 | [N] | Which 1024 px strip within tile (0-based) |
y_offsets | int32 | [N] | Y position of chunk top edge in page (px) |
tile_heights | int32 | [N] | Actual chunk height in pixels |
page_heights | int32 | [N] | Full page height in pixels |
viewport_widths | int32 | [N] | Page render width in pixels (capped at 875) |
image_hashes | S32 | [N] | MD5 hex digest of source chunk PNG |
tile_paths | S512 | [N] | Absolute path to the chunk PNG file |
shard_id | int32 | scalar | Shard number (derived from the shard directory name) |
(article_id, tile_index, chunk_index).
pixelrag build-index
Merge all shard.npz files, deduplicate, and build a FAISS IVF index (default) or upload to a Qdrant collection.
Options
Directory containing
shard_*.npz files written by pixelrag embed.Directory to write
index.faiss, metadata.npz, and summary.json.Number of IVF clusters. The default of 4096 is suitable for approximately 30 million vectors.
pixelrag index build auto-adjusts this based on the actual vector count.Default search
nprobe stored in the index and returned by /status.Index backend:
"faiss" (default) or "qdrant".Qdrant server or Qdrant Cloud URL. Required when
--backend qdrant.Qdrant collection name.
Upsert into an existing Qdrant collection instead of failing.
Delete and recreate an existing Qdrant collection before uploading.
Examples
--output-dir: