Fastest Hyperbolic Vector DB Client
Project description
HyperspaceDB Python SDK
Official Python client for HyperspaceDB gRPC API (v2.2.1).
The SDK is designed for production services and benchmark tooling:
- collection management
- single and batch insert
- single and batch vector search
- graph traversal API methods
- optional embedder integrations
- multi-tenant metadata headers
Requirements
- Python 3.8+
- Running HyperspaceDB server (default gRPC endpoint:
localhost:50051)
Installation
pip install hyperspacedb
Optional embedder extras:
pip install "hyperspacedb[openai]"
pip install "hyperspacedb[all]"
Quick Start
from hyperspace import HyperspaceClient
client = HyperspaceClient("localhost:50051", api_key="I_LOVE_HYPERSPACEDB")
collection = "docs_py"
client.delete_collection(collection)
client.create_collection(collection, dimension=3, metric="cosine")
client.insert(
id=1,
vector=[0.1, 0.2, 0.3],
metadata={"source": "demo"},
collection=collection,
)
results = client.search(
vector=[0.1, 0.2, 0.3],
top_k=5,
collection=collection,
)
print(results)
client.close()
Batch Search (Recommended for Throughput)
queries = [
[0.1, 0.2, 0.3],
[0.3, 0.1, 0.4],
]
batch_results = client.search_batch(
vectors=queries,
top_k=10,
collection="docs_py",
)
search_batch reduces per-request RPC overhead and should be preferred for high concurrency.
API Summary
Collection Operations
create_collection(name, dimension, metric) -> booldelete_collection(name) -> boollist_collections() -> list[str]get_collection_stats(name) -> dict
Data Operations
insert(id, vector=None, document=None, metadata=None, collection="", durability=Durability.DEFAULT) -> boolbatch_insert(vectors, ids, metadatas=None, collection="", durability=Durability.DEFAULT) -> boolsearch(vector=None, query_text=None, top_k=10, filter=None, filters=None, hybrid_query=None, hybrid_alpha=None, collection="") -> list[dict]search_batch(vectors, top_k=10, collection="") -> list[list[dict]]
For filters with type="range", decimal thresholds are supported (gte_f64/lte_f64 in gRPC payload are set automatically for non-integer values).
Maintenance Operations
rebuild_index(collection, filter_query=None) -> booltrigger_vacuum() -> booltrigger_snapshot() -> boolconfigure(ef_search=None, ef_construction=None, collection="") -> boolsubscribe_to_events(types=None, collection=None) -> Iterator[dict]
filter_query example:
client.rebuild_index(
"docs_py",
filter_query={"key": "energy", "op": "lt", "value": 0.1},
)
CDC subscription example:
for event in client.subscribe_to_events(types=["insert", "delete"], collection="docs_py"):
print(event)
Hyperbolic Math Utilities
from hyperspace import (
mobius_add,
exp_map,
log_map,
parallel_transport,
riemannian_gradient,
frechet_mean,
)
Durability Levels
Use Durability enum values:
Durability.DEFAULTDurability.ASYNCDurability.BATCHDurability.STRICT
Multi-Tenancy
Pass user_id to include x-hyperspace-user-id on all requests:
client = HyperspaceClient(
"localhost:50051",
api_key="I_LOVE_HYPERSPACEDB",
user_id="tenant_a",
)
Best Practices
- Reuse one client instance per worker/process.
- Prefer
search_batchfor benchmark and high-QPS paths. - Chunk large inserts instead of one huge request.
- Keep vector dimensionality aligned with collection configuration.
Error Handling
The SDK catches gRPC errors and returns False / [] in many methods.
For strict production observability, log return values and attach metrics around failed operations.
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
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 hyperspacedb-2.2.1.tar.gz.
File metadata
- Download URL: hyperspacedb-2.2.1.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
597feaa3bfd9c245c3e4a21e7dff40b1893dc4273d7555300395db5a59d39f62
|
|
| MD5 |
8fd3c4c2d769dd8087f9d67270284980
|
|
| BLAKE2b-256 |
5c565d9005a2602882070c11fbd6438f2abff59fd11e87c3844e7bb34177a7f5
|
File details
Details for the file hyperspacedb-2.2.1-py3-none-any.whl.
File metadata
- Download URL: hyperspacedb-2.2.1-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8455bf5f41e0f0260564f055e722de734ae3e4fbff3339c877389d96f9086e88
|
|
| MD5 |
9e68550b0f989b12b3b49078caff9648
|
|
| BLAKE2b-256 |
ab0d5d654aa5a39e4a127da1f4538714279b3220409bb838066fa30cb0e33608
|