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 uses a single IVF index type, 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
  • embedding_model: The configured embedding-model name, or "" if none
  • metadata_schema: Per-field metadata indexing overrides as a flat map {field: {'filterable': bool, 'pattern': bool, 'full_text': bool}}; empty when using the default index-everything posture
  • bm25: {'k1': float, 'b': float, 'analyzer_version': str} when the index has at least one full_text field, else None

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.
index_key= is required. For an RBAC user, pass the user’s KEK as index_key= together with their user_id=.

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.
index_key= is required. For an RBAC user, pass the user’s KEK as index_key= together with their user_id=.

Exceptions

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

Example Usage