Initialize

🚀 Getting Started: Initializing the Client

The first step to using the enVector SDK is to initialize the client environment. This process establishes a connection to the service and sets up the necessary enVector keys. The pyenvector.init() function is a convenient helper designed to make this process simple.

The pyenvector.init() Function

The pyenvector.init() function is a high-level helper that handles both the connection to the enVector service and the key management in a single call. If encryption keys do not exist at the specified path, it will automatically generate them for you, easily preparing everything needed to use the SDK.

Internally, this convenient init() function combines the functionality of two core components:

  • init_connect(): Establishes the connection to the service.

  • init_index_config(): Configures the keys and index settings.

Basic Usage Example

import pyenvector as ev

# Initialize the client environment
ev.init(
    address="localhost:50050",  # Address of the enVector service (host:port)
    key_path="./keys",          # Base directory to store keys
    key_id="ev-key",             # A unique ID to distinguish this key set
    host=None,                   # Host of the enVector service
    port=None,                   # Port of the enVector service
    access_token=None,           # Access Token of the enVector service
    index_name=None,
    dim=None,
    auto_key_setup=None,
    metadata_encryption=None,
    seal_mode=None,
    seal_kek_path=None,
    query_encryption=None,
    index_encryption=None,
    preset=None,
    eval_mode=None,
    index_type=None,
)

print("enVector SDK has been successfully initialized!")

After calling ev.init(), the SDK client is fully configured and ready to communicate with the server, handle data encryption, and perform operations.

For a complete list of parameters related to connection and index configuration, please proceed to the next section.

Last updated