fix vector db sql injection (#16096)
This commit is contained in:
parent
750ec55646
commit
33ba7e659b
4 changed files with 14 additions and 3 deletions
|
|
@ -125,6 +125,8 @@ class MyScaleVector(BaseVector):
|
|||
|
||||
def _search(self, dist: str, order: SortOrder, **kwargs: Any) -> list[Document]:
|
||||
top_k = kwargs.get("top_k", 4)
|
||||
if not isinstance(top_k, int) or top_k <= 0:
|
||||
raise ValueError("top_k must be a positive integer")
|
||||
score_threshold = float(kwargs.get("score_threshold") or 0.0)
|
||||
where_str = (
|
||||
f"WHERE dist < {1 - score_threshold}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue