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.0.0.tar.gz (35.0 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.0.0-cp39-abi3-win_amd64.whl (113.9 kB view details)

Uploaded CPython 3.9+Windows x86-64

minivecdb-1.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.6 kB view details)

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

minivecdb-1.0.0-cp39-abi3-macosx_11_0_arm64.whl (187.0 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for minivecdb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2e46976b29d6966cefdd99cedb7ed6f61f961e3ee8df484bd471dd76a7732f78
MD5 f807ebbf498139e0086361bbe052df77
BLAKE2b-256 8024b4bbaff951e23e6d60c29eeba05d752380cbfbd5eb7cb4f2c1964f39c4bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.0.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.0.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: minivecdb-1.0.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 113.9 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.0.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6cdc62678b0f719a20a67e56af7d9309d8aabd55ece0c5c81aa6086211396f0e
MD5 323746e3f72ff477ef4cf898d125ebf4
BLAKE2b-256 cd666f878435106a2a38b97b33fbcc94dd27c20a2a5503c59ada3058e1c8da5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.0.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.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for minivecdb-1.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 333438f721c3c431d0473479af2daa3d750ca2f22dcba462dab51fa7a4fb7f42
MD5 ec95ab7c66d85b7573054842fb17777e
BLAKE2b-256 83ceba8232afd982d3009fe674cc1a4098c697d53af65f3b15eaf02c67dd9a2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.0.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.0.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for minivecdb-1.0.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d24058db26703c7d2ae5bccd26aed9ddc6cf5aad6dc312524a418a7b0d246ddf
MD5 42c5dcc193820838f2b0ab8672970fa4
BLAKE2b-256 735addb84d1e930b40fd140e37b3ebf458eb7db9232a39e3ce616d29134caaab

See more details on using hashes here.

Provenance

The following attestation bundles were made for minivecdb-1.0.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