40 lines
1.2 KiB
Markdown
40 lines
1.2 KiB
Markdown
# 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
|
||
|
||
```bash
|
||
# Default installation (HNSW backend, recommended)
|
||
uv pip install leann
|
||
|
||
# With DiskANN backend (for large-scale deployments)
|
||
uv pip install leann[diskann]
|
||
```
|
||
|
||
## Quick Start
|
||
|
||
```python
|
||
from leann import LeannBuilder, LeannSearcher, LeannChat
|
||
from pathlib import Path
|
||
INDEX_PATH = str(Path("./").resolve() / "demo.leann")
|
||
|
||
# Build an index
|
||
builder = LeannBuilder(backend_name="hnsw")
|
||
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
|