Skip to main content

Ultra-fast 1-bit quantised vector database with TTL GC — Rust native extension

Project description

minivecdb

Ultra-fast 1-bit quantised vector database with TTL garbage collection — Rust native extension for Python.

pip install minivecdb
pip install "minivecdb[langchain]"  # + LangChain adapter

Same core as @microvecdb/core (browser / Node.js) — compiled from the same Rust codebase via PyO3 + Maturin.

Quick start

from minivecdb import MiniVecDb
import numpy as np, time

db = MiniVecDb(capacity=10_000)

vec = np.random.randn(384).astype(np.float32)
vec /= np.linalg.norm(vec)

db.insert(id=0, vector=vec.tolist(), inserted_at=time.time() * 1000)
db.build_index(m=16, ef_construction=200)

results = db.search(vec.tolist(), limit=5)
# → [{"id": 0, "score": 1.0, "distance": 0}]

LangChain adapter

from langchain_openai import OpenAIEmbeddings
from minivecdb.langchain import LangChainMiniVecDb

# Ephemeral agent scratchpad — 10 min TTL
with LangChainMiniVecDb(
    embedding=OpenAIEmbeddings(model="text-embedding-3-small"),
    ttl_minutes=10,
    gc_interval_sec=30,
) as memory:
    memory.add_texts(["User mentioned ticket #42-ABC."])
    docs = memory.similarity_search("what is the ticket number?", k=3)

TTL & GC

Every text has a wall-clock TTL. A daemon GC thread tombstones expired vectors automatically. Set ttl_minutes=0 (default) to disable.

count = store.run_gc()  # manual GC cycle — returns tombstone count
store.destroy()         # stop GC thread, free native memory

Benchmarks

Metric Result
Search latency (10k vectors) 0.08 ms
RAM per vector (384-dim) 48 B (vs 1,536 B f32)
Recall@5 (sentence embeddings) 100%

License

MIT

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

minivecdb-1.1.0.tar.gz (37.2 kB view details)

Uploaded Source

Built Distributions

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

minivecdb-1.1.0-cp39-abi3-win_amd64.whl (116.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

minivecdb-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (211.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

minivecdb-1.1.0-cp39-abi3-macosx_11_0_arm64.whl (189.4 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file minivecdb-1.1.0.tar.gz.

File metadata

  • Download URL: minivecdb-1.1.0.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for minivecdb-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0c9c7b5ff62d2ef866f11242522be0b297b84cb28132293cc845e4c16b05486c
MD5 05cd63c3cbaee2faaa2bf9371327408a
BLAKE2b-256 2dd84593ecdccd08e039a9ccde58cf48c67e155f1633cb993c96da588bdb13b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.1.0.tar.gz:

Publisher: publish-pypi.yml on Alekkk777/MiniVecDb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file minivecdb-1.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: minivecdb-1.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 116.7 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for minivecdb-1.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 1d77bff632957d0bcfae3166166823dc35a943fc722e3cbf4a2cebb9300da4c2
MD5 3551cf2f7750ac069839335d95f22075
BLAKE2b-256 9b8c78ee13b604df2b2b4099f2f4dec7728a58055eaef81890f465be3586fd9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.1.0-cp39-abi3-win_amd64.whl:

Publisher: publish-pypi.yml on Alekkk777/MiniVecDb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file minivecdb-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for minivecdb-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fae9d008963f478861ca28c6df6ab28e8ada93a86368d7ce8cfc53c322ba0ed5
MD5 15e80a20b4f325b60a8aaafbfcd94dd7
BLAKE2b-256 e0b04eaeebb44def9b0b2ac32e855c6bfaa71930fb9052ecc6144c7c23c89395

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on Alekkk777/MiniVecDb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file minivecdb-1.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for minivecdb-1.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe5d522d0bbab99ff7c12785428def9de0af745ac5443d21dda3c655d1030562
MD5 7e32aae811c98d015eaeeb2128079692
BLAKE2b-256 51cd6dd4ae0448f9468f6cbfa631422a7847a4bb4c4c6fe0402c27b5f540832b

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on Alekkk777/MiniVecDb

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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