The Client class provides an interface to initialize, create, load and list Encrypted Indexes. Encrypted Indexes, in turn, expose data-related functionality such as upserting, querying, and deleting.

Creating the Client

To create the client, you must define the backing store locations which it will use. At minimum, you must set an index_location (where the index will reside) and a config_location (where the index metadata will reside). For example:

import cyborg_vector_search_py as cvs
import secrets

# Using `memory` storage for this example
# `redis` and `postgres` are also supported

index_location = cvs.DBConfig("memory")  # Where encrypted index is stored (for queries)
config_location = cvs.DBConfig("memory") # Where encrypted index config is stored (for config/loading)

# Create a client
client = cvs.Client(index_location, config_location)

Bear in mind that all contents stored in the backing stores is end-to-end encrypted, meaning that no index contents will be stored in plaintext. For performance reasons, you may wish to use a “fast” backing store option for index_location, such as Redis.

Creating the Client with Item Storage

If you wish to store encrypted items in the index, you will also need to set a item_location:

import cyborg_vector_search_py as cvs

# Using `redis` storage for the index and config
# Using `postgres` storage for the items
index_location = cvs.DBConfig(location="redis", connection_string="redis://localhost")
config_location = cvs.DBConfig(location="redis", connection_string="redis://localhost")
item_location = cvs.DBConfig(location="postgres", table_name="item_table", connection_string="host=localhost dbname=postgres")

# Construct the Client object
client = cvs.Client(index_location=index_location, 
                            config_location=config_location,
                            item_location=item_location)

Item contents will be encrypted prior to being uploaded to the backing store. In most applications, these are accessed less frequently than the index, so a “slower” backing store option can be used, such as PostgreSQL.

Setting Device Configurations

Cyborg Vector Search can be accelerated in two ways:

  • CPU Multithreading (via OpenMP) -> can scale with the number of CPU cores available
  • GPU Acceleration (via CUDA & cuVS) -> can increase the speed of certain operations (e.g., ingestion) by an order of magnitude.

You can control either of these with the optional cpu_threads and gpu_accelerate flags:

# ... existing setup
client = cvs.Client(index_location=index_location, 
                            config_location=config_location,
                            item_location=item_location,
                            cpu_threads=4,
                            gpu_accelerate=False)
gpu_accelerate can only be set to True if running on a CUDA-enabled system with the CUDA driver installed.

By default, cpu_threads will use all available cores, and gpu_accelerate will be set to False.

API Reference

For more information on the Client class, refer to the API Reference: