High-performance Python Vector Database & Memory Engine with RESP2 support.
Project description
⚡ PulseDB
An enterprise-grade, in-memory database with a native AI Vector Engine.
Built for developers who need Redis-compatible storage and lightning-fast semantic search — without running two separate systems.
What is PulseDB?
PulseDB is a high-performance, open-source database that combines:
- A Redis-compatible KV store — Strings, Lists, Hashes with TTL, LRU eviction, and RESP2 wire protocol
- An AI Memory Engine — HNSW-based vector search with native C++ pre-filtering callbacks
- A Python SDK — Ergonomic
db.vectors.upsert()/db.vectors.search()API - A LangChain Integration — Drop-in
PulseDBVectorStorefor RAG pipelines with metadata filtering
One server, one protocol, one SDK. No Pinecone. No Weaviate. No Redis Stack.
Features
| Category | Capability |
|---|---|
| KV Store | SET, GET, DEL, EXPIRE, TTL, MSET, MGET, INCR, APPEND |
| Data Types | Strings · Lists (LPUSH/RPOP/LRANGE) · Hashes (HSET/HGET/HGETALL) |
| Vector Engine | HNSW cosine similarity, O(log N) search, dynamic resizing |
| Hybrid Search | Native C++ pre-filter callbacks — filter by metadata during graph traversal |
| Persistence | Write-Ahead Log (WAL) + JSON snapshots + HNSW binary graph snapshots |
| Protocol | RESP2 TCP (port 6379) — works with redis-cli, redis-py, ioredis |
| Cluster | Consistent hashing, multi-node routing |
| Auth | API Key (HTTP) + REQUIREPASS (TCP) + optional TLS/SSL |
| Observability | Prometheus /metrics endpoint, structured /health and /ready |
| LangChain | PulseDBVectorStore with similarity_search(filter={...}) |
Quickstart
1. Run the Server (Docker)
docker run -d \
-p 6379:6379 \
-p 8000:8000 \
-v pulsedb_data:/app/data \
--name pulsedb \
ghcr.io/gkavinrajancodes/pulsedb:latest
Or use Docker Compose for a 3-node cluster:
git clone https://github.com/gkavinrajanCodes/pulseDB.git
cd pulseDB && docker-compose up --build
2. Install the SDK
pip install pulsedb
3. Use It
from pulsedb import PulseDB
db = PulseDB(host="localhost", port=6379)
# Standard KV Store
db.set("session:abc", "user_data", ttl=3600)
print(db.get("session:abc")) # "user_data"
# AI Memory Engine — insert vectors with metadata
db.vectors.upsert("article:1", [0.12, 0.98, 0.34], metadata={"category": "sports", "year": 2024})
db.vectors.upsert("article:2", [0.91, 0.11, 0.67], metadata={"category": "tech", "year": 2023})
# Semantic similarity search — optionally filter by metadata
results = db.vectors.search([0.10, 0.95, 0.40], top_k=5, filter={"category": "sports"})
# → [{"id": "article:1", "score": 0.997}]
LangChain Integration
PulseDB works natively as a LangChain VectorStore, giving your RAG pipeline blazing fast retrieval with hybrid metadata filtering.
from langchain_openai import OpenAIEmbeddings
from langchain_pulsedb.vectorstore import PulseDBVectorStore
store = PulseDBVectorStore(
embedding=OpenAIEmbeddings(),
host="localhost",
port=6379,
)
# Ingest documents — metadata is automatically stored for hybrid filtering
store.add_texts(
texts=["PulseDB is fast", "Redis is popular", "Pinecone is expensive"],
metadatas=[{"source": "blog"}, {"source": "wiki"}, {"source": "review"}]
)
# Hybrid search — find similar docs but only from the blog source
docs = store.similarity_search("fast database", k=2, filter={"source": "blog"})
How the AI Memory Engine Works
Standard vector databases do post-filtering: search all vectors, get K results, then throw away the ones that don't match the filter. This degrades accuracy.
PulseDB does true pre-filtering using native hnswlib C++ filter callbacks. The filter function is evaluated inside the graph traversal — so the C++ engine skips disqualified nodes entirely before scoring them.
Query Vector → HNSW Graph Traversal → [Filter Callback runs on every node visited]
↓ Pass → included in result set
↓ Fail → skipped immediately
Top-K results returned
This means your effective top_k is always accurate, even with highly restrictive filters.
Architecture
graph TD
Client["Client (SDK / redis-cli)"] -->|RESP2 Binary Protocol| TCP["asyncio TCP Server :6379"]
Client -->|HTTP REST| HTTP["FastAPI Gateway :8000"]
TCP --> Router["Command Router"]
HTTP --> Router
Router --> KV["16-Shard KV Store (LRU + TTL)"]
Router --> VE["AI Vector Engine (hnswlib HNSW)"]
Router --> DT["Data Types (Lists, Hashes)"]
Router --> PS["Pub/Sub Engine"]
KV --> WAL["Write-Ahead Log"]
VE --> Snap["HNSW Binary Snapshot"]
WAL --> Snap
Run Locally (From Source)
# 1. Clone and install
git clone https://github.com/gkavinrajanCodes/pulseDB.git
cd pulseDB
python3.10 -m venv workenv && source workenv/bin/activate
pip install -r requirements.txt
# 2. Start the server
NODE_ID=node1 CLUSTER_NODES=node1 uvicorn server.main:app --host 0.0.0.0 --port 8000
# 3. Install the SDK (in another terminal)
pip install -e sdk/
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/sorted-sets - Commit your changes:
git commit -m "feat: add ZADD/ZRANGE sorted set commands" - Push:
git push origin feature/sorted-sets - Open a Pull Request
All PRs are validated against our CI matrix (Python 3.10, 3.11, 3.12 with flake8, mypy, and pytest).
License
Distributed under the Business Source License (BSL 1.1). See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pulsedb-1.0.2.tar.gz.
File metadata
- Download URL: pulsedb-1.0.2.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3542c86df8cfc0cb0b8dda968cd2bbfe56d215ec72999f8c1289ea93e4956e7
|
|
| MD5 |
33447d802327a3ae6d58a51a1203e103
|
|
| BLAKE2b-256 |
383e76fa35d4870f5b83e322bf56903011da14748b6b51e9c0778039769de587
|
File details
Details for the file pulsedb-1.0.2-py3-none-any.whl.
File metadata
- Download URL: pulsedb-1.0.2-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1c654cbb7553620f73e32372a322cb71b94dffe48ab52da455e43f6b3856472
|
|
| MD5 |
fdaa7f4cf184f763f8989a57774dde3c
|
|
| BLAKE2b-256 |
e72fd21bfa2ecb5efa417385aeb0a5a55e45f5110e863f7d8112a776576108f0
|