Official Python SDK for the REM distributed vector database
Project description
REM Vector Database - Python SDK
Official Python SDK for REM Network — the decentralized vector database for AI applications. A Pinecone-compatible API powered by 2,000+ distributed miners on the Sui blockchain.
Installation
pip install rem-vectordb
With LangChain support:
pip install rem-vectordb[langchain]
With LlamaIndex support:
pip install rem-vectordb[llamaindex]
Quick Start
from rem import REM
client = REM(api_key="rem_your_api_key")
# Create a collection
collection = client.create_collection("my-docs", dimension=1536)
# Upsert vectors
collection.upsert([
{"id": "doc1", "values": [0.1, 0.2, ...], "metadata": {"title": "Hello"}},
{"id": "doc2", "values": [0.3, 0.4, ...], "metadata": {"title": "World"}},
])
# Semantic search
results = collection.query(vector=[0.1, 0.2, ...], top_k=10)
for match in results.matches:
print(f"{match.id}: {match.score:.4f}")
Features
Encrypted Metadata (AES-256-GCM)
Protect sensitive metadata fields with per-namespace encryption. Miners never see your plaintext data.
collection = client.create_collection(
name="secure-docs",
dimension=1536,
encrypted_fields=["text", "user_id", "email"]
)
Hybrid Search (Vector + Keyword)
Combine semantic vector search with BM25 keyword matching via Reciprocal Rank Fusion.
results = collection.query(
vector=[0.1, 0.2, ...],
query_text="machine learning",
hybrid_alpha=0.7, # 0.0=pure keyword, 1.0=pure vector
top_k=10,
)
Metadata Filtering
Pinecone-compatible filter operators: $eq, $gt, $gte, $lt, $lte, $in, $nin, $and, $or.
results = collection.query(
vector=[0.1, 0.2, ...],
top_k=10,
filter={
"$and": [
{"category": {"$eq": "science"}},
{"year": {"$gte": 2020}}
]
},
)
Batch Queries
Execute up to 10 queries in a single API call for recommendation systems and AI agents.
results = collection.query_batch([
{"vector": [0.1, ...], "top_k": 5},
{"vector": [0.3, ...], "top_k": 5, "filter": {"type": "article"}},
{"query_text": "neural networks", "top_k": 3},
])
Fetch & Delete
Retrieve or remove vectors by ID.
# Fetch vectors
fetched = collection.fetch(ids=["doc1", "doc2"])
for v in fetched.vectors:
print(f"{v.id}: {v.metadata}")
# Delete vectors
result = collection.delete(ids=["doc1"])
print(f"Deleted {result.deleted_count} vectors")
Async Support
Full async/await interface for high-throughput applications.
from rem import AsyncREM
async with AsyncREM(api_key="rem_xxx") as client:
collection = await client.create_collection("my-docs", dimension=1536)
await collection.upsert([...])
results = await collection.query(vector=[...], top_k=10)
Framework Integrations
LangChain
from langchain_openai import OpenAIEmbeddings
from rem.integrations.langchain import REMVectorStore
store = REMVectorStore(
api_key="rem_xxx",
collection_name="docs",
embedding=OpenAIEmbeddings(),
)
# Add documents
store.add_texts(["Hello world", "REM is great"], metadatas=[{"source": "test"}])
# Similarity search
results = store.similarity_search("greeting", k=5)
# Use in RAG chains
from langchain.chains import RetrievalQA
qa = RetrievalQA.from_chain_type(llm=llm, retriever=store.as_retriever())
LlamaIndex
from llama_index.core import VectorStoreIndex
from rem.integrations.llamaindex import REMVectorStore
vector_store = REMVectorStore(api_key="rem_xxx", collection_name="docs")
index = VectorStoreIndex.from_vector_store(vector_store)
query_engine = index.as_query_engine()
response = query_engine.query("What is REM Network?")
API Reference
Client
client = REM(
api_key="rem_xxx", # Required (starts with rem_)
base_url="https://api.getrem.online", # Default
timeout=30.0, # Seconds
)
Collections
| Method | Description |
|---|---|
client.create_collection(name, dimension, metric, encrypted_fields) |
Create collection |
client.get_collection(id) |
Get by ID |
client.list_collections() |
List all |
client.delete_collection(id) |
Delete |
Vectors
| Method | Description |
|---|---|
collection.upsert(vectors) |
Insert/update vectors |
collection.query(vector, top_k, filter, query_text, hybrid_alpha) |
Search |
collection.query_batch(queries) |
Batch search (up to 10) |
collection.fetch(ids) |
Fetch by ID |
collection.delete(ids) |
Delete by ID |
collection.stats() |
Collection stats |
Distance Metrics
cosine(default) — Normalized similarityeuclidean— L2 distancedot_product— Inner product
Getting Started
- Sign up at app.getrem.online to get your API key
- You get $20 in free API credits
pip install rem-vectordb- Start building!
Full documentation: app.getrem.online/docs
Links
License
MIT - See LICENSE for details.
Built by BeClever OÜ (Estonia).
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 rem_vectordb-0.2.0.tar.gz.
File metadata
- Download URL: rem_vectordb-0.2.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5141661350de2ca06cf69c68ef3ae884daf38c146f4a1a3709706c4993b8fb74
|
|
| MD5 |
a493add09b75e13307fa4cee41bd02e1
|
|
| BLAKE2b-256 |
064d2ad29d5cecc87b0e34216ee2dbb6c960ee7e12e4529a65f7454879d68adf
|
File details
Details for the file rem_vectordb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: rem_vectordb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b73c7e39c371a1f6e969a9fa13039a51c7841740379800050a019758b7b82a7
|
|
| MD5 |
7c2082786a61ec4ce9f9f6677d804312
|
|
| BLAKE2b-256 |
9507ede64c985e65e3cac25bc10ea8ebd5f377f3a82b9c0d8113d4443a30df13
|