is_trained
ReturnsTrue 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).
Returns
| Return Type | Description |
|---|---|
str | Type of the current index. |
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 vectorsmetric: The distance metric used (e.g., ‘euclidean’, ‘cosine’)index_type: The type of the index (e.g., ‘ivf’, ‘ivfpq’, ‘ivfflat’)n_lists: The number of inverted lists in the indexpq_dim: The PQ dimension (if applicable)pq_bits: The PQ 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
ValueError
ValueError
- Throws if the index was not created or loaded yet.
- Throws if an error occurs during retrieval.