To create an encrypted index, you need to specify an index name (must be unique) and an index key:
from cyborgdb import Client

# Create a client
client = Client(
    base_url='http://localhost:8000', 
    api_key='your-api-key'
)

# Generate an encryption key for the index
index_key = client.generate_key()

# Create an encrypted index
index = client.create_index(
    index_name="my_index", 
    index_key=index_key
)
This creates a new encrypted index with the IVFFlat type by default. For more details on IVFFlat and other index options, see Configure an Encrypted Index.
The example above creates a random 32 byte (256-bit) index key. This is fine for evaluation purposes, but for production use, we recommend that you use an HSM or KMS solution. For more details, see Managing Encryption Keys.

Index Caching

The service-based SDKs handle caching automatically on the server side. Unlike the embedded SDKs, you don’t need to specify cache sizes when creating indexes. The CyborgDB service optimizes query performance through:
  • Automatic index caching based on usage patterns
  • Server-side query optimization
  • Efficient index loading and memory management

Automatic Embedding Generation

To use automatic embedding generation, use the Docker Service or install with pip install cyborgdb-service[embeddings]
All Client SDKs support automatic embedding generation. You can specify an embedding model when creating the index:
from cyborgdb import Client, IndexIVF

# Create a client
client = Client(
    base_url='http://localhost:8000', 
    api_key='your-api-key'
)

# Generate an encryption key for the index
index_key = client.generate_key()

# Set embedding model (from HuggingFace)
embedding_model = "sentence-transformers/all-MiniLM-L6-v2"

# Create an encrypted index with managed embedding generation
index = client.create_index(
    index_name="my_index", 
    index_key=index_key, 
    embedding_model=embedding_model
)

API Reference

For more information on creating encrypted indexes, refer to the API reference: