Python Client SDK for CyborgDB: The Confidential Vector Database
Project description
CyborgDB Python SDK
The CyborgDB Python SDK provides a comprehensive client library for interacting with CyborgDB, the first Confidential Vector Database. This SDK enables you to perform encrypted vector operations including ingestion, search, and retrieval while maintaining end-to-end encryption of your vector embeddings. Built for Python applications, it offers seamless integration into modern Python applications and services.
This SDK provides an interface to cyborgdb-service which you will need to separately install and run in order to use the SDK. For more info, please see our docs.
Key Features
- End-to-End Encryption: All vector operations maintain encryption with client-side keys
- Zero-Trust Design: Novel architecture keeps confidential inference data secure
- High Performance: GPU-accelerated indexing and retrieval with CUDA support
- Familiar API: Easy integration with existing AI workflows
- Flexible Indexing: Support for multiple index types (IVFFlat, IVFPQ, etc.) with customizable parameters
Getting Started
To get started in minutes, check out our Quickstart Guide.
Installation
- Install
cyborgdb-service
# Install the CyborgDB Service
pip install cyborgdb-service
# Or via Docker
docker pull cyborginc/cyborgdb-service
- Install
cyborgdbSDK:
# Install the CyborgDB Python SDK
pip install cyborgdb
Usage
from cyborgdb import Client
# Initialize the client
client = Client('https://localhost:8000', 'your-api-key')
# Generate a 32-byte encryption key
index_key = client.generate_key()
# Create an encrypted index
index = client.create_index(
index_name='my-index',
index_key=index_key
)
# Add encrypted vector items
items = [
{
'id': 'doc1',
'vector': [0.1] * 128, # Replace with real embeddings
'contents': 'Hello world!',
'metadata': {'category': 'greeting', 'language': 'en'}
},
{
'id': 'doc2',
'vector': [0.1] * 128, # Replace with real embeddings
'contents': 'Bonjour le monde!',
'metadata': {'category': 'greeting', 'language': 'fr'}
}
]
index.upsert(items)
# Query the encrypted index
query_vector = [0.2] * 128 # 128 dimensions
results = index.query(query_vectors=query_vector,top_k=5)
# Print the results
for result in results:
print(f"ID: {result['id']}, Distance: {result['distance']}")
Advanced Usage
Batch Queries
# Search with multiple query vectors simultaneously
query_vectors = [
[0.1] * 128,
[0.2] * 128
]
batch_results = index.query(query_vectors=query_vectors, top_k=5)
# Print the results (batch queries return list of lists)
for i, query_results in enumerate(batch_results):
print(f"\nResults for query {i}:")
for result in query_results:
print(f" ID: {result['id']}, Distance: {result['distance']}")
Metadata Filtering
# Search with metadata filters
query_vector = [0.1] * 128
results = index.query(
query_vectors=query_vector,
top_k=10,
n_probes=1,
greedy=False,
filters={'category': 'greeting', 'language': 'en'},
include=['distance', 'metadata', 'contents']
)
# Print the results
for result in results:
print(f"ID: {result['id']}, Distance: {result['distance']}, Metadata: {result['metadata']}")
Documentation
For more information on CyborgDB, see the Cyborg Docs.
License
The CyborgDB Python SDK is licensed under the MIT License.
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 cyborgdb-0.14.0.tar.gz.
File metadata
- Download URL: cyborgdb-0.14.0.tar.gz
- Upload date:
- Size: 54.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b76cd845dc13032b0609981a9a9c92f9ec51a4caa15048f7c7f3f8b01214ad9
|
|
| MD5 |
83830a0b06bb6c712177a3d6c7683ce0
|
|
| BLAKE2b-256 |
7e3083bd20d26ef6185945fe3682bde31b8d2b89f65a0f5d5a138187c9bcfd31
|
Provenance
The following attestation bundles were made for cyborgdb-0.14.0.tar.gz:
Publisher:
build_and_package_wheels.yml on cyborginc/cyborgdb-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cyborgdb-0.14.0.tar.gz -
Subject digest:
4b76cd845dc13032b0609981a9a9c92f9ec51a4caa15048f7c7f3f8b01214ad9 - Sigstore transparency entry: 728435197
- Sigstore integration time:
-
Permalink:
cyborginc/cyborgdb-py@d20f9a2b7f8c1f367f6e81b91a282a527c4ce6a9 -
Branch / Tag:
refs/tags/v0.14.0 - Owner: https://github.com/cyborginc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_package_wheels.yml@d20f9a2b7f8c1f367f6e81b91a282a527c4ce6a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cyborgdb-0.14.0-py3-none-any.whl.
File metadata
- Download URL: cyborgdb-0.14.0-py3-none-any.whl
- Upload date:
- Size: 91.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c86c432b75fec184dc7a978678c6f40a375281a0101e26c13c78d8c841744584
|
|
| MD5 |
65a8845db55f4afc849b8c2476809e92
|
|
| BLAKE2b-256 |
097d5a77abf851073e77b0eebe3d6ff5ff650bfdda634c845243b4b5875509a3
|
Provenance
The following attestation bundles were made for cyborgdb-0.14.0-py3-none-any.whl:
Publisher:
build_and_package_wheels.yml on cyborginc/cyborgdb-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cyborgdb-0.14.0-py3-none-any.whl -
Subject digest:
c86c432b75fec184dc7a978678c6f40a375281a0101e26c13c78d8c841744584 - Sigstore transparency entry: 728435198
- Sigstore integration time:
-
Permalink:
cyborginc/cyborgdb-py@d20f9a2b7f8c1f367f6e81b91a282a527c4ce6a9 -
Branch / Tag:
refs/tags/v0.14.0 - Owner: https://github.com/cyborginc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_and_package_wheels.yml@d20f9a2b7f8c1f367f6e81b91a282a527c4ce6a9 -
Trigger Event:
push
-
Statement type: