Client is the main class exposed by CyborgDB. It exposes the functionality necessary to create, load, list and delete indexes. Operations within encrypted indexes (such as upsert and query) are contained within the EncryptedIndex class returned by create_index and load_index.
Constructor
Client instance.
Parameters
| Parameter | Type | Default | Description | 
|---|---|---|---|
api_key | str | - | API key for your CyborgDB account. | 
index_location | DBConfig | - | Configuration for index storage location. Use a dictionary with keys location, table_name, and connection_string. | 
config_location | DBConfig | - | Configuration for index metadata storage. Uses the same dictionary structure as index_location. | 
items_location | DBConfig | NONE | (Optional) Configuration for encrypted item storage. Uses the same dictionary structure as index_location. | 
cpu_threads | int | 0 | (Optional) Number of CPU threads to use for computations (defaults to 0 = all cores). | 
gpu_accelerate | bool | False | (Optional) Indicates whether to use GPU acceleration (defaults to False). | 
Exceptions
ValueError
ValueError
- Throws if the 
cpu_threadsparameter is less than0. - Throws if any 
DBConfigis invalid. - Throws if the GPU is not available when 
gpu_accelerateisTrue. 
RuntimeError
RuntimeError
- Throws if the backing store is not available.
 - Throws if the Client could not be initialized.
 
Example Usage
Methods
get_cpu_threads()
Returns the number of CPU threads configured for this client.Returns
int: The number of CPU threads.
Example Usage
is_gpu_enabled()
Checks if GPU acceleration is enabled for this client.Returns
bool: True if GPU acceleration is enabled, False otherwise.