elips/docs
Practice

Guides

Short, task-shaped walkthroughs. Each one starts from Getting started and ends with a runnable snippet.

A small RAG store

Persist chunked documents with lineage, query by text, and surface the original passage on every hit.

python
import elips

db = elips.open("/var/lib/rag", dimension=384, metric="cosine")
docs = db.vault("docs")

for chunk in iter_chunks(corpus):
    docs.place_document(
        chunk.text,
        {"source": chunk.source_id, "page": chunk.page},
        lineage=elips.EmbeddingLineage(
            provider="local",
            model="default_v1",
            revision="2024-01",
        ),
    )

db.checkpoint()

for hit in docs.seek_text("how do we rotate keys?", top=5):
    print(hit.document.text, hit.payload, hit.distance)

Shared-reader fan-out

One writer process refreshes the database; many reader processes serve queries with read-only handles.

python
# writer.py — exclusive lock
writer = elips.open("/srv/index", dimension=768)

# reader.py — shared lock, can run in N processes concurrently
reader = elips.open("/srv/index", access_mode="read_only")
result = reader.vault("docs").seek_text("status of incident 9412", top=10)

Reindex without downtime

Build a fresh index in a sibling directory, swap atomically, and let readers pick it up on their next open.

python
new = elips.open("/srv/index.next", dimension=768)
hydrate(new)
new.compact()
new.close()

# atomic swap
os.rename("/srv/index", "/srv/index.prev")
os.rename("/srv/index.next", "/srv/index")

Bulk import

bash
elips import /srv/index --vault docs --input dump.jsonl --dimension 768
elips checkpoint /srv/index