Skip to content

Commit 032ceca

Browse files
committed
Add CLI parameters for StreamingPerformanceCase configuration
1 parent 61725a3 commit 032ceca

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

vectordb_bench/backend/cases.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,21 @@ def __init__(
459459
)
460460

461461
if isinstance(search_stages, str):
462-
search_stages = json.loads(search_stages)
462+
# Handle both JSON array format and comma-separated format
463+
search_stages = search_stages.strip()
464+
if search_stages.startswith('['):
465+
search_stages = json.loads(search_stages)
466+
else:
467+
# Convert comma-separated string to list of floats
468+
search_stages = [float(x.strip()) for x in search_stages.split(',')]
463469
if isinstance(concurrencies, str):
464-
concurrencies = json.loads(concurrencies)
470+
# Handle both JSON array format and comma-separated format
471+
concurrencies = concurrencies.strip()
472+
if concurrencies.startswith('['):
473+
concurrencies = json.loads(concurrencies)
474+
else:
475+
# Convert comma-separated string to list of ints
476+
concurrencies = [int(x.strip()) for x in concurrencies.split(',')]
465477

466478
super().__init__(
467479
name=name,

vectordb_bench/cli/cli.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ def get_custom_case_config(parameters: dict) -> dict:
193193
"dataset_with_size_type": parameters["dataset_with_size_type"],
194194
"label_percentage": parameters["label_percentage"],
195195
}
196+
elif parameters["case_type"] == "StreamingPerformanceCase":
197+
custom_case_config = {
198+
"dataset_with_size_type": parameters["dataset_with_size_type"],
199+
"insert_rate": parameters["insert_rate"],
200+
"search_stages": parameters["search_stages"],
201+
"concurrencies": parameters["concurrencies"],
202+
}
196203
return custom_case_config
197204

198205

@@ -455,6 +462,33 @@ class CommonTypedDict(TypedDict):
455462
show_default=True,
456463
),
457464
]
465+
insert_rate: Annotated[
466+
int,
467+
click.option(
468+
"--insert-rate",
469+
help="Insert rate (vectors/sec) for StreamingPerformanceCase",
470+
default=500,
471+
show_default=True,
472+
),
473+
]
474+
search_stages: Annotated[
475+
str,
476+
click.option(
477+
"--search-stages",
478+
help="Search stages (comma-separated floats, e.g., '0.5,0.6,0.7,0.8,0.9') for StreamingPerformanceCase",
479+
default="0.5,0.8",
480+
show_default=True,
481+
),
482+
]
483+
concurrencies: Annotated[
484+
str,
485+
click.option(
486+
"--concurrencies",
487+
help="Concurrency levels (comma-separated ints, e.g., '5,10,15') for StreamingPerformanceCase",
488+
default="5,10",
489+
show_default=True,
490+
),
491+
]
458492

459493

460494
class HNSWBaseTypedDict(TypedDict):

0 commit comments

Comments
 (0)