Class HNSWConfig (0.2.0)

HNSWConfig(
    name: str,
    field_name: typing.Optional[str] = None,
    vector_size: int = 128,
    distance_strategy: langchain_community.vectorstores.utils.DistanceStrategy = DistanceStrategy.COSINE,
    initial_cap: int = 10000,
    m: int = 16,
    ef_construction: int = 200,
    ef_runtime: int = 10,
)

Initializes the HNSWConfig object.

Parameters

NameDescription
name str

The unique name for the vector index, serving as an identifier within the vector store or database system.

field_name str

The name of the field in the dataset that holds the vector data to be indexed. This specifies which part of the data structure is used for indexing and searching.

vector_size int

The dimensionality of the vectors that the index will accommodate. All vectors must match this specified size.

distance_strategy DistanceStrategy

The metric used for calculating distances or similarities between vectors, influencing how search results are ranked.

initial_cap int

Specifies the initial capacity of the index in terms of the number of vectors it can hold, impacting the initial memory allocation.

m int

Determines the maximum number of outgoing edges each node in the index graph can have, directly affecting the graph's connectivity and search performance.

ef_construction int

Controls the size of the dynamic candidate list during the construction of the index, influencing the index build time and quality.

ef_runtime int

Sets the size of the dynamic candidate list during search queries, balancing between search speed and accuracy.