Index#
- class vecworks.Index#
Data class specifying how a
Retrievermay access an index associated with a vector store.Fundamentals#
- __init__(name: str, distance: DISTANCES, vectorizer: Vectorizer | None = None, density: DENSITY | None = None, max_distance: float | None = None, top_k: int | None = None, bind: str | None = None, return_distance_as: str | None = None)#
Initializes the dataclass.
Parameters#
- name
Name of the vector index to access.
- distance
Distance function, specified using
DISTANCES, to calculate the similarity of the (vectorized) input passed to the retriever with the indexed vectors.- vectorizer
Vectorizer used to vectorize input passed to the retriever. If no vectorizer is specified, the input will be kept as-is.
- density
The density of the vectors stored in the index, as classified using
DENSITY.- max_distance
Maximum distance under which indices are still considered for selection. This value depends on the distance function applied. Refer to
DISTANCESfor guidance.- top_k
Maximum number of hits to retrieve from the vector index. If neither threshold nor top_k are set, this parameter is automatically set to 10.
- bind
Name of the argument passed to the
Retriever, which contents should be vectorized and compared with the index. If no name is passed, it is set to the contents of name.- return_distance_as
Name of the return variable holding the calculate distance. If no name is specified, the distance is not included in the output.