File tree Expand file tree Collapse file tree
vectordb_bench/backend/clients Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- from pydantic import BaseModel , SecretStr , validator
1+ from pydantic import BaseModel , SecretStr
22
33from ..api import DBCaseConfig , DBConfig , MetricType
44
@@ -20,14 +20,6 @@ def to_dict(self) -> dict:
2020 "url" : self .url .get_secret_value (),
2121 }
2222
23- @validator ("*" )
24- def not_empty_field (cls , v : any , field : any ):
25- if field .name in ["api_key" , "db_label" ]:
26- return v
27- if isinstance (v , str | SecretStr ) and len (v ) == 0 :
28- raise ValueError ("Empty string!" )
29- return v
30-
3123
3224class QdrantIndexConfig (BaseModel , DBCaseConfig ):
3325 metric_type : MetricType | None = None
Original file line number Diff line number Diff line change 1- from pydantic import SecretStr , BaseModel , validator
2- from ..api import DBConfig , DBCaseConfig , MetricType
1+ from pydantic import BaseModel , SecretStr
2+
3+ from ..api import DBCaseConfig , DBConfig , MetricType
34
45
56class TiDBConfig (DBConfig ):
@@ -10,10 +11,6 @@ class TiDBConfig(DBConfig):
1011 db_name : str = "test"
1112 ssl : bool = False
1213
13- @validator ("*" )
14- def not_empty_field (cls , v : any , field : any ):
15- return v
16-
1714 def to_dict (self ) -> dict :
1815 pwd_str = self .password .get_secret_value ()
1916 return {
@@ -33,10 +30,10 @@ class TiDBIndexConfig(BaseModel, DBCaseConfig):
3330 def get_metric_fn (self ) -> str :
3431 if self .metric_type == MetricType .L2 :
3532 return "vec_l2_distance"
36- elif self .metric_type == MetricType .COSINE :
33+ if self .metric_type == MetricType .COSINE :
3734 return "vec_cosine_distance"
38- else :
39- raise ValueError (f"Unsupported metric type: { self . metric_type } " )
35+ msg = f"Unsupported metric type: { self . metric_type } "
36+ raise ValueError (msg )
4037
4138 def index_param (self ) -> dict :
4239 return {
You can’t perform that action at this time.
0 commit comments