Vector
Vector indexer module.
VectorDBIndexer(vector_capability)
Bases: BaseIndexer
Index elements into a vector datastore capability.
Initialize the indexer with an optional vector capability instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vector_capability
|
VectorCapability
|
The capability implementation
(for example, |
required |
delete(**kwargs)
Delete documents from the vector capability based on the file ID.
Kwargs
file_id (str): The ID of the file(s) to be deleted.
Raises:
| Type | Description |
|---|---|
ValueError
|
If file_id is not provided. |
Exception
|
If an error occurs during deletion. |
index(elements, **kwargs)
Index elements into the configured vector capability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
elements
|
list[dict[str, Any]]
|
Parsed elements containing text and metadata. |
required |
**kwargs
|
Any
|
Additional keyword arguments for customization. |
{}
|
Kwargs
replace_file_id (str, optional): File identifier to be replaced before indexing. Defaults to None. If provided, existing records for this file_id are removed first. batch_size (int, optional): The number of chunks to process in each batch. Defaults to 100. max_retries (int, optional): The maximum number of retry attempts for failed batches. Defaults to 3. vectors (list[Vector] | None, optional): Pre-computed vectors for the elements. If provided, uses create_from_vector instead of create. Must match the length of elements. Defaults to None.
Raises:
| Type | Description |
|---|---|
Exception
|
If an error occurs during indexing. |