Skip to main content

Fast personal vector database with persistent storage and semantic search

Project description

PocketVectorDB

A lightweight, fast, offline-ready vector database for Python and mobile/edge environments

PocketVectorDB is a minimal, dependency-light vector database designed for:

  • Offline AI agents
  • Termux (Android) environments
  • Edge devices & IoT
  • Local LLM memory systems
  • Developers who want fast semantic search without massive dependencies

Built for simplicity and speed, PocketVectorDB stores embeddings in a compact NumPy matrix, supports metadata filtering, batch inserts, persistent storage, and cosine similarity search — all in under 10KB of Python code.

====================================================================== 🚀 Features

  • Ultra-lightweight: no server, no heavy frameworks
  • Fast cosine similarity search via optimized matrix operations
  • Persistent storage using embeddings.npy and metadata.json
  • Batch insert operations
  • Metadata filtering (where={...})
  • Full CRUD operations
  • Zero external dependencies except NumPy
  • Works on Termux, Linux, macOS, and Windows
  • Perfect for small AI agents and local LLM memory

====================================================================== 📦 Installation

Python

pip install pocketvectordb

Termux

Install from a local wheel:

pip install pocketvectordb-1.0.0-py3-none-any.whl

====================================================================== 🧠 Quick Start

from pocketvectordb import VectorDB
import numpy as np

db = VectorDB("./my_vectordb", dimension=384)

embedding = np.random.randn(384).astype(np.float32)
doc_id = db.add(embedding, "Hello world!", metadata={"tag": "greeting"})

query = np.random.randn(384).astype(np.float32)
results = db.query(query, n_results=3)

print(results["documents"])

====================================================================== 🔍 Similarity Search

results = db.query(query_embedding, n_results=5)

Returns:

  • ids
  • documents
  • distances
  • metadatas

====================================================================== 🗂️ Metadata Filtering

results = db.query(
    query_embedding,
    n_results=3,
    where={"category": "science"}
)

====================================================================== ✏️ Updating Documents

db.update(
    doc_id,
    text="Updated content",
    metadata={"updated": True}
)

====================================================================== 🗑️ Delete Matching Documents

deleted_count = db.delete(where={"category": "tech"})

====================================================================== 💾 Persistence

Every write updates:

  • embeddings.npy
  • metadata.json

Reloading is automatic:

db = VectorDB("./my_vectordb")
print(db.count())

====================================================================== 📊 Performance

Benchmarks on Android (Termux):

Documents Insert Time Query Time
100 0.017s 0.14 ms
500 0.39s 0.31 ms
1000 1.56s 0.53 ms

PocketVectorDB is optimized for fast local lookups without GPU or FAISS.

====================================================================== 🛠️ Why PocketVectorDB?

Most vector databases are:

  • too heavy
  • server-based
  • cloud-locked
  • not optimized for mobile
  • overkill for small agents

PocketVectorDB is a pure-Python, offline-first, minimalist vector engine.

Perfect for:

  • LLM memory systems
  • Personal agents
  • Offline chatbots
  • IoT classification
  • Fast lookup systems
  • Mobile AI experiments
  • Students & researchers

====================================================================== ❤️ Author

ThatFkrDurk561

PocketVectorDB is built for developers who want speed, portability, and simplicity without massive frameworks.

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

pocketvectordb-1.0.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

pocketvectordb-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pocketvectordb-1.0.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pocketvectordb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e1ee0829094ee5c99614ed48f7488ae78ef33958338544dccb7c70b2806eb6ce
MD5 753bda49326cd235bffe89ec9609f538
BLAKE2b-256 2e0b287d563ccb88a4b7e9d9eb5a3fb39bc79868e4c2f3a1129d1c3356493647

See more details on using hashes here.

File details

Details for the file pocketvectordb-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pocketvectordb-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for pocketvectordb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a15d6b81abd2c84dfa9276c97ac407572bf08e5049ebe660112db9501fb2c7f4
MD5 d6e4c6831b69332b54fec5e7627835d2
BLAKE2b-256 aff4c16a8f2e7a30a293554a933602b4819f9dbb175433bd9df5db3a26a7c24f

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