Skip to main content

is_trained

Returns True only when training is complete, enabling efficient approximate nearest neighbor search. An untrained index defaults to exhaustive search.

Returns

bool: True only when the index is fully trained; otherwise, False.
is_trained() returns False while a (re)train rebuild is in progress. During that window, queries transparently fall back to the untrained (exhaustive) search path. To distinguish “untrained” from “currently (re)training”, use is_training() or training_state().

Example Usage


is_training

Returns True while a (re)train rebuild is in progress. While this is True, is_trained() returns False and queries fall back to exhaustive search.

Returns

bool: True if a training rebuild is currently running; otherwise, False.

Example Usage


training_state

Returns the current training state of the index as a string.

Returns

str: One of "untrained", "training", or "trained".

Example Usage


index_name

Retrieves the name of the current index.

Returns

str: Name of the currently loaded or created index.

Example Usage


index_type

Returns the type of the current index. CyborgDB indexes are DiskIVF indexes, so this returns "disk_ivf".

Returns

Example Usage


index_config

Retrieves the configuration details of the current index.

Returns

dict: A dictionary containing the configuration of the index with the following keys:
  • dimension: The dimensionality of the vectors
  • metric: The distance metric used (e.g., 'euclidean', 'cosine')
  • index_type: The type of the index ('disk_ivf')
  • n_lists: The number of inverted lists in the index

Example Usage


n_lists

Returns the number of inverted lists in the index. This property is set during training and initially defaults to 1.

Returns

int: The number of inverted lists in the index.

Example Usage


dimension

Returns the dimensionality of the vectors in the index.

Returns

int: The dimensionality of the vectors.

Example Usage


metric

Returns the distance metric used by the index.

Returns

str: The distance metric used (e.g., "euclidean", "cosine", "squared_euclidean").

Example Usage


get_num_vectors

Returns the number of vectors currently stored in the index.

Returns

int: The number of vectors in the index.
The simple call reuses the key supplied at create_index() / load_index(). Pass index_key= (and user_id= for an RBAC user) to override the per-operation key in stateless/service deployments.

Example Usage


list_ids

Lists all item IDs currently stored in the index.

Returns

List[str]: A list containing all item IDs in the index.
The simple call reuses the key supplied at create_index() / load_index(). Pass index_key= (and user_id= for an RBAC user) to override the per-operation key in stateless/service deployments.

Exceptions

  • Throws if the index was not created or loaded yet.
  • Throws if an error occurs during retrieval.

Example Usage