Skip to main content
Trains the encrypted index to optimize it for efficient similarity search queries. Training is essential for IVF-based indexes to achieve optimal query performance and accuracy.
In CyborgDB Service, training is typically handled automatically by the service. However, you can explicitly trigger training once enough vectors have been added.

Parameters

Training is a compute-intensive operation that may take several seconds to minutes depending on the index size and configuration.

Returns

Promise<TrainResponse>: A Promise that resolves to a response object containing the operation status and training completion message. See the TrainResponse type for more details.

Exceptions

  • Throws if the API request fails due to network connectivity issues.
  • Throws if authentication fails (invalid API key).
  • Throws if the encryption key is invalid for the specified index.
  • Throws if there are insufficient resources to complete training.
  • Throws if the index has no vectors to train on.
  • Throws if the index configuration is incompatible with training.
  • Throws if training parameters are out of valid ranges.
  • Throws if training fails to converge within the specified parameters.

Example Usage

Custom Training Parameters

Response Format

The method returns a response object with the following structure:

Response Fields