skeg-llamaindex
LlamaIndex VectorStore adapter for skeg.
Compatible with llama-index-core >= 0.10.
Talks to skeg over RESP3 (skeg-resp3, port 6379). That is where the
TurboQuant tiers live: the native binary protocol cannot name them,
because its kind byte 3 means PQ.
Install
pip install skeg-llamaindex
Pulls in skeg (Python client) and llama-index-core automatically.
Server install (skeg engine) is separate:
brew tap skegdb/tap
brew install skeg
Usage
from llama_index.core import VectorStoreIndex, StorageContext, Document
from llama_index.core.node_parser import SentenceSplitter
from skeg_llamaindex import SkegVectorStore
# 1. Start a skeg RESP3 server:
# skeg-resp3 --data-dir ./data --addr 127.0.0.1:6379
# 2. Point the adapter at it. `dim` must match the embedding model.
store = SkegVectorStore.from_uri(
"skeg://127.0.0.1:6379/notes",
dim=1024, # mxbai-embed-large-v1 dimension
backend="flat", # in-RAM flat index for <50K vectors
# kind defaults to "tq2"; see the tier table below
)
# 3. Wire into LlamaIndex.
ctx = StorageContext.from_defaults(vector_store=store)
docs = [Document(text="hello world"), Document(text="goodbye world")]
index = VectorStoreIndex.from_documents(docs, storage_context=ctx)
# 4. Query as usual.
engine = index.as_query_engine()
print(engine.query("what does the first doc say?"))
Quantisation tier (kind)
kind |
What it is | When |
|---|---|---|
tq2 |
TurboQuant, 2 bits/dim. The default. | Start here. Near-f32 recall at a fraction of the RAM |
tq1 |
TurboQuant, 1 bit/dim | Tightest memory budget, some recall given up |
tq4 |
TurboQuant, 4 bits/dim | When tq2 measurably loses recall on your data |
int8 |
8-bit integer | Previous default; kept for existing indexes |
f32 |
No quantisation | Exact scores, largest footprint |
binary |
1-bit sign | Hamming distance, specialised use |
The tier is fixed when the index is created. Changing it means creating a new index and re-ingesting.
Index backend choice
| Use case | backend |
Notes |
|---|---|---|
| Personal AI, < 50K nodes | flat |
Exhaustive scan; fast on M-series CPUs |
| RAG over a fixed corpus, > 50K nodes | disk_vamana (pre-build) |
Use skeg-cli build, then serve read-only |
| Streaming insert with eventual large size | disk_vamana (RW) |
Delta WAL handles streaming |
For the pre-build path, build offline once and start the server in serve mode; this adapter then queries it read-only:
# Build the index offline (one shell):
skeg-cli build --input embeddings.npy --output ./data --name notes
# Serve it read-only (another shell):
skeg-resp3 --mode serve --data-dir ./data --tier tq2
What this adapter handles
add(nodes): VSET each embedding + KV-store the text + metadataquery(VectorStoreQuery): VSEARCH top-k, returns node_ids + similaritydelete(ref_doc_id): VDEL + drop KV keys- Stable mapping
node_id (str) → vec_id (u64)via xxh3
What this adapter does not do
- Metadata filter pushdown: LlamaIndex post-filters returned hits.
(The server does support
SKEG.VSEARCH ... FILTER; this adapter does not translate LlamaIndex filters onto it yet.) - Batched VSET: one VSET per node on the synchronous path. For large
corpora build the index offline with
skeg-cli buildand serve it read-only. (The server does supportSKEG.VMSET; wiring it up here is open work.) - Hybrid sparse+dense search: skeg's surface is dense-only.
- Async API: this adapter is synchronous.
Test-suite safety
The pytest suite spawns its own skeg-resp3 via the conftest fixture
and tears it down at the end. Set SKEG_RESP3_BIN to the binary, or
the tests skip. The tests create VINDEX entries with
names like notes-<test_name> and drop them after each test. If you
ever override the fixture to point at an external server, those
VINDEX names may collide with yours. The fixture is the safe default.
License
Apache-2.0.
Release files for skeg-llamaindex 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| skeg_llamaindex-0.2.0.tar.gz | 19.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| skeg_llamaindex-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.3 kB
Release files / skeg_llamaindex-0.2.0.tar.gz
| Download URL | skeg_llamaindex-0.2.0.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
faaf5a0e5a5703175eaa7498b345ba8a457b5042d4f653fd36fb40cf372a4418
|
|
BLAKE2b-256 checksum How to use checksums |
a1f279ef0756d75cabe5f643bdeef9ed609df9b02cc5f83bb6c38ba174334062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / skeg_llamaindex-0.2.0-py3-none-any.whl
| Download URL | skeg_llamaindex-0.2.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5d30fd6dfe3f39b41a11777fc2ac88e532f33a9dc74ddd8b14da791410f18e1
|
|
BLAKE2b-256 checksum How to use checksums |
89d8ce04b353c6faf455c376f244fd0576bc2eced91084d388abe8f50b70d2e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|