Skip to main content

Embedded vector store for local-first AI applications.

Project description

Python Binding

The first language target now has a concrete package layout:

  • Rust extension crate in bindings/python/src/lib.rs
  • Python package in bindings/python/vectlite
  • packaging via maturin

Local Development

cd bindings/python
maturin develop
pytest

Install From PyPI

pip install vectlite

Release history lives in CHANGELOG.md.

TestPyPI Release

From the repo root:

./scripts/publish_testpypi.sh

Then upload with a TestPyPI token:

export TEST_PYPI_API_TOKEN="pypi-..."
UPLOAD=1 ./scripts/publish_testpypi.sh

The full flow is documented in docs/testpypi-release.md in the repository.

PyPI Release

From the repo root:

./scripts/publish_pypi.sh

Then upload with a PyPI token:

export PYPI_API_TOKEN="pypi-..."
UPLOAD=1 ./scripts/publish_pypi.sh

The full flow is documented in docs/pypi-release.md in the repository.

API

import vectlite

db = vectlite.open("knowledge.vdb", dimension=384)
with db.transaction() as tx:
    tx.upsert(
        "doc1",
        embedding,
        {"source": "notes", "priority": 10, "title": "Auth setup"},
        namespace="notes",
        sparse={"auth": 1.0, "sso": 0.5},
        vectors={"title": title_embedding, "body": body_embedding},
    )
    tx.upsert_many(
        [
            {
                "id": "doc2",
                "vector": other_embedding,
                "sparse": {"auth": 0.7},
                "metadata": {"source": "notes", "text": "billing and auth notes"},
            }
        ],
        namespace="notes",
    )

record = db.get("doc1")
results = db.search(
    query,
    k=5,
    filter={"source": {"$ne": "blog"}, "priority": {"$gte": 5, "$lte": 20}},
    namespace="notes",
    sparse={"auth": 1.0},
    vector_name="title",
    dense_weight=1.0,
    sparse_weight=1.0,
    fusion="rrf",
    rrf_k=30,
    fetch_k=20,
    mmr_lambda=0.3,
    explain=True,
    rerank=vectlite.rerankers.compose(
        vectlite.rerankers.text_match(),
        vectlite.rerankers.metadata_boost("source", {"notes": 0.2}),
    ),
)

debug = db.search_with_stats(
    query,
    k=5,
    namespace="notes",
    sparse={"auth": 1.0},
    vector_name="title",
    fusion="rrf",
    fetch_k=20,
    mmr_lambda=0.3,
)

db.compact()
print(db.wal_path)

Supported metadata/filter value types are:

  • str
  • int
  • float
  • bool
  • None
  • list
  • dict

Supported filter operators in the MVP are:

  • equality with {"field": "value"}
  • {"field": {"$eq": "value"}}
  • {"field": {"$contains": "auth"}}
  • {"field": {"$gt": 5}}
  • {"field": {"$gte": 5}}
  • {"field": {"$lt": 20}}
  • {"field": {"$lte": 20}}
  • {"field": {"$ne": "value"}}
  • {"field": {"$in": ["a", "b"]}}
  • {"field": {"$nin": ["a", "b"]}}
  • {"field": {"$exists": True}}
  • {"$and": [...]}
  • {"$or": [...]}
  • {"$not": {...}}

Batch helpers available on Database:

  • insert_many(records)
  • upsert_many(records)
  • delete_many(ids)

Durability helpers available on Database:

  • transaction() for atomic batched writes
  • wal_path to inspect the write-ahead log path
  • compact() / flush() to checkpoint the snapshot and clear the WAL

Dense vector helpers available on Database:

  • upsert(..., vectors={"title": [...], "body": [...]})
  • search(..., vector_name="title")
  • get(id)["vectors"]

Namespace helpers available on Database:

  • every CRUD/search method accepts namespace=...
  • search(..., all_namespaces=True)
  • namespaces()

Text helpers available at package level:

  • vectlite.upsert_text(db, id, text, embed, ...)
  • vectlite.search_text(db, query, embed, ...)
  • vectlite.search_text_with_stats(db, query, embed, ...)
  • vectlite.sparse_terms(text)

Retrieval Quality

  • sparse retrieval uses a real inverted index with BM25-style scoring
  • fetch_k controls how many candidates are gathered before truncation
  • mmr_lambda enables MMR diversification for dense, sparse, or hybrid search
  • fusion="linear" and fusion="rrf" control dense+sparse score fusion
  • rerank(query, results) can reorder the top candidates from Python
  • rerank_k limits how many initial candidates are sent into the rerank hook
  • vectlite.rerankers.text_match() boosts metadata text/title overlap
  • vectlite.rerankers.metadata_boost(field, boosts) boosts metadata values
  • vectlite.rerankers.compose(...) chains rerankers sequentially or with RRF
  • db.search_with_stats(...) returns both results and search diagnostics
  • explain=True adds per-result debug payloads with ranks, matched terms, and rerank traces
  • lower mmr_lambda favors diversity more aggressively; higher values stay closer to raw relevance

ANN Behavior

  • dense and hybrid search use HNSW indexes when enough points are present
  • named vector spaces get their own dense ANN indexes
  • ANN sidecars are persisted on disk and reloaded on open when the manifest still matches the record set
  • sparse-only search remains exact but uses the inverted index instead of a full scan
  • small collections stay on exact dense search to avoid ANN overhead and low-cardinality edge cases
  • writes land in a crash-safe WAL first, then compact() checkpoints back into the .vdb snapshot
  • the .vdb snapshot plus .wal are the source of truth; ANN sidecars are acceleration artifacts

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

vectlite-0.1.2.tar.gz (51.1 kB view details)

Uploaded Source

Built Distributions

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

vectlite-0.1.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

vectlite-0.1.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ ARM64

vectlite-0.1.2-cp39-abi3-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9+Windows x86-64

vectlite-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

vectlite-0.1.2-cp39-abi3-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

vectlite-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

vectlite-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file vectlite-0.1.2.tar.gz.

File metadata

  • Download URL: vectlite-0.1.2.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vectlite-0.1.2.tar.gz
Algorithm Hash digest
SHA256 de2e12105520c518d517728581f3bc7f24ab42d1aca01edd2f95481a390b6c0f
MD5 a7af4327efcabedea3f5448e9806e0d4
BLAKE2b-256 da6ada1676c1dd8d29158327d1a90992707c17661ce4a0efa3d1c94957ef7ab0

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vectlite-0.1.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3b75a22ac495dc82da05d9da1eddf36a785922e388625ba9fb64a4fedf50f216
MD5 398df7cc66c6fc087202f18727bcfa1f
BLAKE2b-256 8a98ce2b70437bd19b82b5be3a1d548239b4012edcdc38837c60cef80eb4c2d4

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vectlite-0.1.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e369dc788bc811356320fc18228741f326a2b47d5779ac428933815a0255ac4f
MD5 4a35710553af26965dbe8bd525875115
BLAKE2b-256 e8fdd214031b94785791a9c1657ae9a3bf95b241cddb8c51307df5da7daae318

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: vectlite-0.1.2-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for vectlite-0.1.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 bf247775c0828bb8c8d2a8feb0fb8b44cfd8f8b762efd60794f61824b8d9cc0b
MD5 af1a819f3c374761e7779dcb04290cad
BLAKE2b-256 d3166fd547155c07d11b6e20e0456b5d62cc1ff99a4397e04408778e16b29515

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for vectlite-0.1.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2dbb6eb0ac3eed20e2a907321684272bd7940117adcd9908e8d3d46497463206
MD5 4f1429f1830ef81a430b9dc58f5b11b8
BLAKE2b-256 2ee8d5d75f4181777de7e69af61e5759d36734e15e9d695661b2554d5bc46f13

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for vectlite-0.1.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 127da74213f8de5fb4d500dda80c5631827540aabba7c87012ccd582bc6c2fcd
MD5 363c254cbc5d898aa6108172191b02c8
BLAKE2b-256 2e670045208c0e1ed59ed0cb7a56b33cab9394fb1d1cdfe0f7677a07136c13f3

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for vectlite-0.1.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6c2d797f4f99b78a9eb91ed8dbf1287615b8ea6abf38ee356eb9fa5a1accc45f
MD5 51c47330d8259e0ad768563d5520225f
BLAKE2b-256 f029fb00cdc3dace70e1d050c0eb0b24bd392ac716a56903d5ef0336dca76f96

See more details on using hashes here.

File details

Details for the file vectlite-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for vectlite-0.1.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b89df6f43de183cac8d03c7fe0a9cfd07e05d00defa0427f9810a2c33911959
MD5 b5a62eafbf2134e92ae894576de1b764
BLAKE2b-256 75343721dee0a310a2b0267c5599e134a4f46dc45ce2e7212420057283135835

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