Skip to main content

is_trained

Returns True if the index has been trained, enabling efficient approximate nearest neighbor search. An untrained index will default to exhaustive search.

Returns

bool: True if the index has been trained; otherwise, False.

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 (e.g., ivf, ivfpq, ivfflat, ivfsq).

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 (e.g., ‘ivf’, ‘ivfpq’, ‘ivfflat’, ‘ivfsq’)
  • n_lists: The number of inverted lists in the index
  • pq_dim: The PQ dimension (if applicable)
  • pq_bits: The PQ bits (if applicable)
  • sq_bits: The SQ bits (if applicable)

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.

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.

Exceptions

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

Example Usage