From de2ab4fc16fc0d2e5ba9118fceef94975ff06360 Mon Sep 17 00:00:00 2001 From: Wahaj Ali Date: Tue, 19 Mar 2024 10:52:50 +0500 Subject: [PATCH] Rename variables --- vectordb_bench/backend/clients/pgvector/config.py | 15 ++++----------- .../backend/clients/pgvector/pgvector.py | 4 ++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/vectordb_bench/backend/clients/pgvector/config.py b/vectordb_bench/backend/clients/pgvector/config.py index 3cf19993c..056127a72 100644 --- a/vectordb_bench/backend/clients/pgvector/config.py +++ b/vectordb_bench/backend/clients/pgvector/config.py @@ -51,22 +51,15 @@ def parse_metric_fun_str(self) -> str: class HNSWConfig(PgVectorIndexConfig): - M: int - efConstruction: int + m: int + ef_construction: int ef: int | None = None index: IndexType = IndexType.HNSW def index_param(self) -> dict: return { - "metric_type": self.parse_metric(), - "index_type": self.index.value, - "params": {"M": self.M, "efConstruction": self.efConstruction}, - } - - def index_param(self) -> dict: - return { - "m" : self.M, - "efConstruction" : self.efConstruction, + "m" : self.m, + "ef_construction" : self.ef_construction, "metric" : self.parse_metric() } diff --git a/vectordb_bench/backend/clients/pgvector/pgvector.py b/vectordb_bench/backend/clients/pgvector/pgvector.py index a69b7cbde..f05c119b5 100644 --- a/vectordb_bench/backend/clients/pgvector/pgvector.py +++ b/vectordb_bench/backend/clients/pgvector/pgvector.py @@ -109,10 +109,10 @@ def _create_index(self): index_param = self.case_config.index_param() if self.case_config.index == IndexType.HNSW: - log.debug(f'Creating HNSW index. m={index_param["m"]}, ef_construction={index_param["ef_construction"]}') + log.debug(f'Creating HNSW index. m={index_param["m"]}, ef_construction={index_param["ef_construction"]}.') self.cursor.execute(f'CREATE INDEX IF NOT EXISTS {self._index_name} ON public."{self.table_name}" USING hnsw (embedding {index_param["metric"]}) WITH (m={index_param["m"]}, ef_construction={index_param["ef_construction"]});') elif self.case_config.index == IndexType.IVFFlat: - log.debug(f'Creating IVFFLAT index. list={index_param["lists"]}') + log.debug(f'Creating IVFFLAT index. list={index_param["lists"]}.') self.cursor.execute(f'CREATE INDEX IF NOT EXISTS {self._index_name} ON public."{self.table_name}" USING ivfflat (embedding {index_param["metric"]}) WITH (lists={index_param["lists"]});') else: assert "Invalid index type {self.case_config.index}"