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.1.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.1-cp39-abi3-win_amd64.whl (113.9 kB view details)

Uploaded CPython 3.9+Windows x86-64

minivecdb-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (208.7 kB view details)

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

minivecdb-1.0.1-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.1.tar.gz.

File metadata

  • Download URL: minivecdb-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 7d478b55022ceec8096fe39c41c8203e2a3d64ebd702982a3ef4c280fc8cda9b
MD5 a00dfe40ca54705d535fcbe371702712
BLAKE2b-256 c655003abc6121fe4baba4667298fa8f89b25897518424c8f9db33d3be909977

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: minivecdb-1.0.1-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.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 103532cde911e3091cc08e7d5d0cb975ee4943b9377c51667ba8a2dda9310643
MD5 e5e20d829bf503d7400daa948d7bfc5a
BLAKE2b-256 5edd413fd2d812bbb5da33abf8f22592cdf361186f621f0047460c56a98c709d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for minivecdb-1.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2704324ac59357d32b77dd31360a542f910ef7c03cf1811aa79dee7f75c1422e
MD5 613993af2e270faa53e042ffd9b4d267
BLAKE2b-256 55eba38f4b212523eac1ed47aa1dead50d1d30d2895a82514b1b6b0f919e813c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for minivecdb-1.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be978694bfcdfdae70b43d3964c9ec699f2bcacf58383747fdbd1f571fbaa2f0
MD5 4e3b802d4bcc7facb482d40c904a78ed
BLAKE2b-256 93ed8bb87c4f2ee8eed84b5b3cdebadcafdcc943840b541a5687eddf19f914fd

See more details on using hashes here.

Provenance

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