Skip to content

Commit fed4c1d

Browse files
make collection name configurable (#671)
1 parent 21eafc1 commit fed4c1d

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

vectordb_bench/backend/clients/zilliz_cloud/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ class ZillizTypedDict(CommonTypedDict):
4747
show_default=True,
4848
),
4949
]
50+
collection_name: Annotated[
51+
str,
52+
click.option(
53+
"--collection-name",
54+
type=str,
55+
help="Collection name for Zilliz",
56+
required=False,
57+
default="ZillizCloudVDBBench",
58+
show_default=True,
59+
),
60+
]
5061

5162

5263
@cli.command()
@@ -62,6 +73,7 @@ def ZillizAutoIndex(**parameters: Unpack[ZillizTypedDict]):
6273
user=parameters["user_name"],
6374
password=SecretStr(parameters["password"]),
6475
num_shards=parameters["num_shards"],
76+
collection_name=parameters["collection_name"],
6577
),
6678
db_case_config=AutoIndexConfig(
6779
level=int(parameters["level"]) if parameters["level"] else 1,

vectordb_bench/backend/clients/zilliz_cloud/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@ class ZillizCloudConfig(DBConfig):
99
user: str
1010
password: SecretStr
1111
num_shards: int = 1
12+
collection_name: str = "ZillizCloudVDBBench"
1213

1314
def to_dict(self) -> dict:
1415
return {
1516
"uri": self.uri.get_secret_value(),
1617
"user": self.user,
1718
"password": self.password.get_secret_value(),
1819
"num_shards": self.num_shards,
20+
"collection_name": self.collection_name,
1921
}
2022

2123

vectordb_bench/backend/task_runner.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,14 @@ def init_db(self, drop_old: bool = True) -> None:
117117
# If anything goes wrong, fall back silently; Doris will use its default name logic
118118
collection_name = None
119119

120+
# Check if collection_name is in the db_config (e.g., for Zilliz, Milvus)
121+
db_config_dict = self.config.db_config.to_dict()
122+
if "collection_name" in db_config_dict and not collection_name:
123+
collection_name = db_config_dict.pop("collection_name")
124+
120125
self.db = db_cls(
121126
dim=self.ca.dataset.data.dim,
122-
db_config=self.config.db_config.to_dict(),
127+
db_config=db_config_dict,
123128
db_case_config=self.config.db_case_config,
124129
drop_old=drop_old,
125130
with_scalar_labels=self.ca.with_scalar_labels,

0 commit comments

Comments
 (0)