autointent.context.vector_index_client.VectorIndexClient#
- class autointent.context.vector_index_client.VectorIndexClient(embedder_device, db_dir, embedder_batch_size=32, embedder_max_length=None, embedder_use_cache=False)#
Client interface for managing vector indexes.
This class provides methods for creating, persisting, loading, and deleting vector indexes. Indexes are stored in a specified directory and associated with embedding models.
- Parameters:
- embedder_device#
- db_dir#
- embedder_batch_size = 32#
- embedder_max_length = None#
- embedder_use_cache = False#
- create_index(model_name, utterances=None, labels=None)#
Create a new vector index for the specified model.
- Parameters:
- Returns:
A VectorIndex instance.
- Raises:
ValueError – If only one of utterances or labels is provided.
- Return type:
autointent.context.vector_index_client._vector_index.VectorIndex
- dump(index)#
Persist the vector index to disk.
- Parameters:
index (autointent.context.vector_index_client._vector_index.VectorIndex) – The VectorIndex instance to save.
- Return type:
None
- delete_index(model_name)#
Delete a vector index and its associated data.
- Parameters:
model_name (str) – Name of the model.
- Return type:
None
- get_index(model_name)#
Load a vector index for a given model.
- Parameters:
model_name (str) – Name of the model.
- Returns:
The loaded VectorIndex instance.
- Raises:
NonExistingIndexError – If the index does not exist.
- Return type:
autointent.context.vector_index_client._vector_index.VectorIndex
- exists(model_name)#
Check if a vector index exists for a given model.
- delete_db()#
Delete all vector indexes and their associated data from disk.
- Return type:
None