Skip to main content

DeepLightRAG: High-performance Document Indexing and Retrieval System (use with any LLM)

Project description

DeepLightRAG

PyPI version License: MIT

High-performance document indexing and retrieval system. Works with any LLM.

Features

  • Dual-Layer Graph: Visual-Spatial + Entity-Relationship architecture
  • GLiNER2 NER: Zero-shot entity extraction with fastino/gliner2-base-v1
  • DeepSeek-OCR: Visual token compression for efficient document processing
  • TOON Format: Token-efficient context formatting via toon-python
  • Any LLM: Works with OpenAI, Gemini, Claude, Ollama, MLX

Installation

pip install deeplightrag

With GPU (CUDA):

pip install "deeplightrag[gpu]"

macOS (Apple Silicon):

pip install "deeplightrag[macos]"

Quick Start

Python API

from deeplightrag import DeepLightRAG

# Initialize
rag = DeepLightRAG()

# Index document
rag.index_document("document.pdf", document_id="doc_001")

# Retrieve
result = rag.retrieve("What are the key findings?")
print(result["context"])

CLI

# Index
deeplightrag index document.pdf

# Query
deeplightrag retrieve "What is the main topic?"

Architecture

┌─────────────────────────────────────────────┐
│              DeepLightRAG                   │
├─────────────────────────────────────────────┤
│  DeepSeek-OCR → Visual Token Compression    │
├─────────────────────────────────────────────┤
│  Dual-Layer Graph                           │
│  ├── Layer 1: Visual-Spatial (WHERE)        │
│  └── Layer 2: Entity-Relationship (WHAT)    │
├─────────────────────────────────────────────┤
│  GLiNER2 → Entity Extraction                │
├─────────────────────────────────────────────┤
│  Adaptive Retriever → Context Generation    │
└─────────────────────────────────────────────┘

Configuration

# config.yaml
ocr:
  model_name: "deepseek-ai/DeepSeek-OCR"
  resolution: "gundam"

ner:
  model_name: "fastino/gliner2-base-v1"
  confidence_threshold: 0.3

retrieval:
  top_k: 5

Requirements

  • Python >= 3.9
  • CUDA GPU recommended for DeepSeek-OCR
  • Dependencies: gliner2, toon-python, networkx, torch

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deeplightrag-1.0.22-py3-none-any.whl (100.9 kB view details)

Uploaded Python 3

File details

Details for the file deeplightrag-1.0.22-py3-none-any.whl.

File metadata

  • Download URL: deeplightrag-1.0.22-py3-none-any.whl
  • Upload date:
  • Size: 100.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for deeplightrag-1.0.22-py3-none-any.whl
Algorithm Hash digest
SHA256 3a7483c173abce0721598b139a2653ad18abc115b5ed2ac07b65d928fbbaf753
MD5 bbbe8b42f62d16d233f6b8e343451756
BLAKE2b-256 fe9b060e46ace047964a0c0181736c9d99947f2380f4f55ea45739b0940b5316

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page