Skip to main content

LEANN - The smallest vector index in the world. RAG Everything with LEANN!

Project description

LEANN - The smallest vector index in the world

LEANN is a revolutionary vector database that democratizes personal AI. Transform your laptop into a powerful RAG system that can index and search through millions of documents while using 97% less storage than traditional solutions without accuracy loss.

Installation

# Default installation (includes both HNSW and DiskANN backends)
uv pip install leann

# CPU-only install (Linux)
uv pip install \
  --default-index https://download.pytorch.org/whl/cpu \
  --index https://pypi.org/simple \
  --index-strategy first-index \
  "leann[cpu]"

Quick Start

from leann import LeannBuilder, LeannSearcher, LeannChat
from pathlib import Path
INDEX_PATH = str(Path("./").resolve() / "demo.leann")

# Build an index (choose backend: "hnsw" or "diskann")
builder = LeannBuilder(backend_name="hnsw")  # or "diskann" for large-scale deployments
builder.add_text("LEANN saves 97% storage compared to traditional vector databases.")
builder.add_text("Tung Tung Tung Sahur called—they need their banana‑crocodile hybrid back")
builder.build_index(INDEX_PATH)

# Search
searcher = LeannSearcher(INDEX_PATH)
results = searcher.search("fantastical AI-generated creatures", top_k=1)

# Chat with your data
chat = LeannChat(INDEX_PATH, llm_config={"type": "hf", "model": "Qwen/Qwen3-0.6B"})
response = chat.ask("How much storage does LEANN save?", top_k=1)

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 Distribution

leann-0.3.7.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

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

leann-0.3.7-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file leann-0.3.7.tar.gz.

File metadata

  • Download URL: leann-0.3.7.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for leann-0.3.7.tar.gz
Algorithm Hash digest
SHA256 85da2069124b034b40f303c3ee90c3f502fa90a6184f991d0e1b80502d2d493f
MD5 ef72e7cbee24961895cb3582863db6f4
BLAKE2b-256 d397b3bc416dc2e5d83b3b0c73dd3a04aa7ee792e169818a496a057678187545

See more details on using hashes here.

File details

Details for the file leann-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: leann-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for leann-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 47ccf739be13fc97945ffde859247e9b2211b8e45807e03d25a592f5d0ef83a1
MD5 0cfba04235e91863fc622be1389c4c08
BLAKE2b-256 b41a644602dd998ae2886f5750d6600296006c1d1a7e26c68f5844a577d32a2d

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