Skip to main content

Location

The Location enum contains the supported index backing store locations for Cyborg Vector Search. These are:

LocationConfig

(Equivalent to the Python DBConfig) LocationConfig defines the storage location for various index components.

Constructor

Parameters

Example Usage


DistanceMetric

The DistanceMetric enum contains the supported distance metrics for Cyborg Vector Search. These are:

IndexConfig

IndexConfig is an abstract base class for configuring index types. The three derived classes can be used to configure indexes:

IndexIVF

Ideal for large-scale datasets where fast retrieval is prioritized over high recall:

Constructor

Parameters

IndexIVFFlat

Suitable for applications requiring high recall with less concern for memory usage:

Constructor

Parameters

IndexIVFPQ

Product Quantization compresses embeddings, making it suitable for balancing memory use and recall:

Constructor

Parameters


Array2D

Array2D class provides a 2D container for data, which can be initialized with a specific number of rows and columns, or from an existing vector.

Constructors

  • Array2D(size_t rows, size_t cols, const T& initial_value = T()): Creates an empty 2D array with specified dimensions.
  • Array2D(std::vector<T>&& data, size_t cols): Initializes the 2D array from a 1D vector.
  • Array2D(const std::vector<T>& data, size_t cols): Initializes the 2D array from a 1D vector (copy).

Access Methods

  • operator()(size_t row, size_t col) const: Access an element at the specified row and column (read-only).
  • operator()(size_t row, size_t col): Access an element at the specified row and column (read-write).
  • size_t rows() const: Returns the number of rows.
  • size_t cols() const: Returns the number of columns.
  • size_t size() const: Returns the total number of elements.

Example Usage


TrainingConfig

The TrainingConfig struct defines parameters for training an index, allowing control over convergence and memory usage.

Constructor

Parameters


QueryParams

The QueryParams struct defines parameters for querying the index, controlling the number of results and probing behavior.

Constructor

Parameters

Higher n_probes values may improve recall but could slow down query time, so select a value based on desired recall and performance trade-offs.

QueryResults

QueryResults class holds the results from a Query operation, including IDs and distances for the nearest neighbors of each query.

Access Methods

Example Usage