Skip to main content

Fast personal vector database with persistent storage and semantic search

Project description

PocketVectorDB Logo

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.1.tar.gz (9.4 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.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pocketvectordb-1.0.1.tar.gz
  • Upload date:
  • Size: 9.4 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.1.tar.gz
Algorithm Hash digest
SHA256 f5de4c4ce991a5b654074468b618b7a7d0a1659a27e82552ec16c39a33b695ee
MD5 f97acc85ea0214895f916e05d124a687
BLAKE2b-256 a46883b74cdcb3ab6f6b626730cfa2e195c78fd5b0e4dd2cae16985249ce846b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pocketvectordb-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c2cceb64c6a4e8fd0311e44eb566a14f40ab9267f9a4e3015cc983fb5b22d66
MD5 d2a50adcb8bf5a905768286b9fc03449
BLAKE2b-256 c3d938fed831ae3c9e32262daae1c4f71fbd9736ea402b8b6472464619ee2782

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