Metadata-Version: 2.2
Name: cyborgdb-core
Version: 0.15.0
Summary: Core Python Library for CyborgDB: The Confidential Vector Database
Author: Cyborg Inc.
License: Proprietary
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: C++
Classifier: Topic :: Database
Classifier: Topic :: Database :: Database Engines/Servers
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries
Project-URL: Homepage, https://www.cyborg.co
Project-URL: Documentation, https://docs.cyborg.co
Requires-Python: >=3.10
Requires-Dist: numpy>=1.24.0
Requires-Dist: requests>=2.25.0
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1.0; extra == "langchain"
Requires-Dist: sentence-transformers>=2.2.0; extra == "langchain"
Provides-Extra: embeddings
Requires-Dist: sentence-transformers>=2.2.0; extra == "embeddings"
Description-Content-Type: text/markdown

# CyborgDB Core

![PyPI - Version](https://img.shields.io/pypi/v/cyborgdb_core)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cyborgdb_core)

**CyborgDB** is the first Confidential Vector Database that enables you to ingest & search vectors embeddings in a privacy-preserving manner, without revealing the contents of the vectors themselves. It works with existing DBs (e.g., Postgres, Redis) and enables you to add, query and retrieve vector embeddings with transparent end-to-end encryption.

## Why Confidential?

Vector Search is at the heart of popular AI applications like RAG, recommendation systems, and semantic search. CyborgDB leverages cryptographic hashing and symmetric encryption to enable Approximate Nearest-Neighbor (ANN) search over encrypted space, keeping your vector embeddings secure throughout their lifecycle.

## Key Features

- **End-to-End Encryption**: Vector embeddings remain encrypted throughout their lifecycle, including at search time
- **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
- **Multiple Backing Stores**: Works with PostgreSQL, Redis, and in-memory storage
- **Cloud Ready**: Supports AWS RDS, AWS ElastiCache, Azure Database for PostgreSQL, Azure Cache for Redis, Google Cloud SQL, and Google Cloud Memorystore

## Getting an API Key

To start using `cyborgdb-core`, you will need to get an API key from [db.cyborg.co](https://www.cyborgdb.co). You can sign up for a free account, create an API key and use it immediately.

## Installation

```bash
# Install CyborgDB Core:
pip install cyborgdb-core
```

## Quickstart

```python
import cyborgdb_core as cyborgdb
import secrets

# Set your CyborgDB API key
api_key = 'cyborgdb_000000' # Replace with your actual API key

# Create a client with memory storage
# You can replace this with Postgres
index_location = cyborgdb.DBConfig("memory")  # For index contents
config_location = cyborgdb.DBConfig("memory") # For config/loading
items_location = cyborgdb.DBConfig("memory")  # For item contents

# Create a client
client = cyborgdb.Client(api_key, index_location, config_location, items_location)

# Create an IVFFlat index
index_config = cyborgdb.IndexIVFFlat(dimension=4, n_lists=1024)

# Generate an encryption key for the index
index_key = secrets.token_bytes(32)

# Create an encrypted index
index = client.create_index("my_index", index_key, index_config)

# Add items to the encrypted index
items = [
    {"id": "item_1", "vector": [0.1, 0.2, 0.3, 0.4], "contents": "Hello!"},
    {"id": "item_2", "vector": [0.5, 0.6, 0.7, 0.8], "contents": "Bonjour!"},
    {"id": "item_3", "vector": [0.9, 0.10, 0.11, 0.12], "contents": "Hola!"}
]

index.upsert(items)

# Query the encrypted index
query_vector = [0.1, 0.2, 0.3, 0.4]
results = index.query(query_vector)

# Print the results
for result in results:
    print(f"ID: {result.id}, Distance: {result.distance}")
```

## Connecting to Different Backing Stores

### PostgreSQL

```python
index_location = cyborgdb.DBConfig(
    location="postgres",
    table_name="index_table", 
    connection_string="host=localhost dbname=cyborgdb user=postgres password=postgres"
)
```

### Redis

```python
index_location = cyborgdb.DBConfig(
    location="redis",
    connection_string="redis://localhost"
)
```

## Documentation

For more detailed documentation, visit:
- [CyborgDB Documentation](https://docs.cyborg.co)
- [API Reference](https://docs.cyborg.co/versions/v0.9.x/api-reference/python/introduction)

## System Requirements

- Python 3.9 - 3.13
- Operating Systems: Linux, macOS, or WSL

## License

CyborgDB is provided under a commercial license with a perpetual free tier. Contact [Cyborg](https://www.cyborg.co/contact) or visit the [pricing page](https://www.cyborg.co/pricing) for more information.

## About Cyborg

Cyborg is dedicated to making AI safe and secure. We develop solutions that enable organizations to leverage AI while maintaining the confidentiality and privacy of their data.

[Visit our website](https://www.cyborg.co) | [Contact Us](https://www.cyborg.co/contact)