Returns the type of the index (for example, 'ivfflat', 'ivfpq', or 'ivfsq').
"ivf" is a deprecated index type that may be returned by older indexes. New indexes should use 'ivfflat', 'ivfpq', or 'ivfsq'.
Returns
str: The index type.
Example Usage
index_type = index.index_typeprint(f'Index type: {index_type}')# Output: "ivfflat", "ivfpq", or "ivfsq"if index_type == 'ivfsq': print('Using IVFSQ index for high accuracy and memory efficiency')elif index_type == 'ivfpq': print('Using IVFPQ index for memory efficiency')elif index_type == 'ivfflat': print('Using IVFFlat index for high accuracy')else: print('Unknown index type')
is_trained
def is_trained(self) -> bool
Returns whether the index has been trained. Training is required for optimal query performance on IVF-based indexes.
Returns
bool: True if the index has been trained, False otherwise.
Example Usage
trained = index.is_trained()print(f'Index trained: {trained}')if not trained: print('Index needs training for optimal performance') index.train()
is_training
def is_training(self) -> bool
Returns whether the index is currently in the process of training.
Returns
bool: True if the index is currently training, False otherwise.
Example Usage
import timeindex.train() # Start trainingwhile index.is_training(): print('Index is still training...') time.sleep(5) # Wait before checking againprint('Index training complete')
index_config
@propertyindex_config: Dict[str, Any]
Returns the index configuration object as a dictionary. The structure depends on the index type.
Returns
Dict[str, Any]: Configuration dictionary containing index parameters.