forked from zilliztech/VectorDBBench
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Unable to run vebbench and cli fix: remove comma of logging str fix cli unable to run zilliztech#444 Signed-off-by: yangxuan <[email protected]> * enhance: Unify optimize and remove ready_to_load PyMilvus used to be the only client that uses ready_to_load. Not it'll load the collection when creating it, so this PR removes `ready_to_load` from the client.API Also this PR enhance optimize and remove the optimize_with_size Signed-off-by: yangxuan <[email protected]> * add mongodb client Signed-off-by: zhuwenxing <[email protected]> * add mongodb client in readme Signed-off-by: zhuwenxing <[email protected]> --------- Signed-off-by: yangxuan <[email protected]> Signed-off-by: zhuwenxing <[email protected]> Co-authored-by: yangxuan <[email protected]> Co-authored-by: zhuwenxing <[email protected]>
- Loading branch information
1 parent
5ebc3e3
commit 729b5b9
Showing
31 changed files
with
383 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from pydantic import BaseModel, SecretStr | ||
|
||
from ..api import DBCaseConfig, DBConfig, IndexType, MetricType | ||
|
||
|
||
class MongoDBConfig(DBConfig, BaseModel): | ||
connection_string: SecretStr = "mongodb+srv://<user>:<password>@<cluster_name>.heatl.mongodb.net" | ||
database: str = "vdb_bench" | ||
|
||
def to_dict(self) -> dict: | ||
return { | ||
"connection_string": self.connection_string.get_secret_value(), | ||
"database": self.database, | ||
} | ||
|
||
|
||
class MongoDBIndexConfig(BaseModel, DBCaseConfig): | ||
index: IndexType = IndexType.HNSW # MongoDB uses HNSW for vector search | ||
metric_type: MetricType | None = None | ||
num_candidates: int | None = 1500 # Default numCandidates for vector search | ||
exact_search: bool = False # Whether to use exact (ENN) search | ||
|
||
def parse_metric(self) -> str: | ||
if self.metric_type == MetricType.L2: | ||
return "euclidean" | ||
if self.metric_type == MetricType.IP: | ||
return "dotProduct" | ||
return "cosine" # Default to cosine similarity | ||
|
||
def index_param(self) -> dict: | ||
return { | ||
"type": "vectorSearch", | ||
"fields": [ | ||
{ | ||
"type": "vector", | ||
"similarity": self.parse_metric(), | ||
"numDimensions": None, # Will be set in MongoDB class | ||
"path": "vector", # Vector field name | ||
} | ||
], | ||
} | ||
|
||
def search_param(self) -> dict: | ||
return {"numCandidates": self.num_candidates if not self.exact_search else None, "exact": self.exact_search} |
Oops, something went wrong.