Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pgvector-hnsw-support #311

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions vectordb_bench/backend/clients/pgvector/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,10 @@ class HNSWConfig(PgVectorIndexConfig):
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,
"ef_construction" : self.efConstruction,
"metric" : self.parse_metric()
}

Expand Down
59 changes: 55 additions & 4 deletions vectordb_bench/frontend/const/dbCaseConfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,27 @@ class CaseConfigInput(BaseModel):
],
)

CaseConfigParamInput_IndexType_PG = CaseConfigInput(
label=CaseConfigParamType.IndexType,
inputType=InputType.Option,
inputConfig={
"options": [
IndexType.HNSW.value,
IndexType.IVFFlat.value,
],
},
)

CaseConfigParamInput_Lists = CaseConfigInput(
label=CaseConfigParamType.lists,
inputType=InputType.Number,
inputConfig={
"min": 1,
"max": 65536,
"value": 10,
"value": 1000,
},
isDisplayed=lambda config: config.get(CaseConfigParamType.IndexType, None)
in [IndexType.IVFFlat.value],
)

CaseConfigParamInput_Probes = CaseConfigInput(
Expand All @@ -387,8 +400,34 @@ class CaseConfigInput(BaseModel):
inputConfig={
"min": 1,
"max": 65536,
"value": 1,
"value": 10,
},
isDisplayed=lambda config: config.get(CaseConfigParamType.IndexType, None)
in [IndexType.IVFFlat.value],
)

CaseConfigParamInput_EF_PG = CaseConfigInput(
label=CaseConfigParamType.EF,
inputType=InputType.Number,
inputConfig={
"min": 1,
"max": 65536,
"value": 128,
},
isDisplayed=lambda config: config.get(CaseConfigParamType.IndexType, None)
in [IndexType.HNSW.value],
)

CaseConfigParamInput_EFC_PG = CaseConfigInput(
label=CaseConfigParamType.EFConstruction,
inputType=InputType.Number,
inputConfig={
"min": 1,
"max": 65536,
"value": 300,
},
isDisplayed=lambda config: config.get(CaseConfigParamType.IndexType, None)
in [IndexType.HNSW.value],
)

CaseConfigParamInput_QuantizationType_PgVectoRS = CaseConfigInput(
Expand Down Expand Up @@ -479,8 +518,20 @@ class CaseConfigInput(BaseModel):
CaseConfigParamInput_NumCandidates_ES,
]

PgVectorLoadingConfig = [CaseConfigParamInput_Lists]
PgVectorPerformanceConfig = [CaseConfigParamInput_Lists, CaseConfigParamInput_Probes]
PgVectorLoadingConfig = [
CaseConfigParamInput_IndexType_PG,
CaseConfigParamInput_Lists,
CaseConfigParamInput_M,
CaseConfigParamInput_EFC_PG
]
PgVectorPerformanceConfig = [
CaseConfigParamInput_IndexType_PG,
CaseConfigParamInput_Lists,
CaseConfigParamInput_Probes,
CaseConfigParamInput_M,
CaseConfigParamInput_EF_PG,
CaseConfigParamInput_EFC_PG
]

PgVectoRSLoadingConfig = [
CaseConfigParamInput_IndexType,
Expand Down