Creates and returns an EncryptedIndex instance based on the provided configuration.
client.create_index(
    index_name,
    index_key,
    index_config,
    embedding_model,
    max_cache_size
)

Parameters

ParameterTypeDefaultDescription
index_namestr-Unique name for the index
index_keybytes-32-byte encryption key
index_configIndexConfig-Index configuration object
embedding_modelstrNone(Optional) Embedding model identifier

Returns

An instance of EncryptedIndex configured with the provided parameters.

Exceptions

Example Usage

Basic usage of the create_index method to create an IVF-Flat index:
from cyborgdb import Client, IndexIVFFlat, generate_key

# Initialize client
client = Client('https://localhost:8000', 'your-api-key')

# Generate a secure encryption key
index_key = generate_key()

# Create a basic IVF-Flat index
config = IndexIVFFlat(dimension=384, n_lists=100, metric="cosine")
index = client.create_index('documents', index_key, config)

IVFPQ Index with Embedding Model

# Create index with embedding model and cache
config = IndexIVFPQ(dimension=768, n_lists=50, pq_bits=8, pq_dim=64, metric="cosine")
index = client.create_index(
    index_name='example_index_name',
    index_key=index_key,
    index_config=config,
    embedding_model='all-MiniLM-L6-v2'
)