Skip to main content
Builds the index using the specified training configuration. Required before efficient querying. Prior to calling this, all queries will be conducted using encrypted exhaustive search. After, they will be conducted using encrypted ANN search.

Parameters

There must be at least 2 * n_lists or 10,000 (whichever is greater) vector embeddings in the index prior to calling this function.

Exceptions

  • Raises an exception if the index was not created or loaded yet.
  • Raises an exception if there are not enough vector embeddings in the index for training (must be at least 2 * n_lists).
  • Raises an exception if the index could not be trained.

Example Usage

Per-operation key override

The calls above reuse the key supplied at create_index() / load_index(). You may instead pass index_key= (and user_id= for an RBAC user) to override the per-operation key. This is required in stateless/service deployments that reload the index per request:
Training requires write permission. An RBAC user without a write wrap cannot train the index.