Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set score_threshold to zero if it is None for MyScale vectordb #7640

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/core/rag/datasource/vdb/myscale/myscale_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:

def _search(self, dist: str, order: SortOrder, **kwargs: Any) -> list[Document]:
top_k = kwargs.get("top_k", 5)
score_threshold = kwargs.get("score_threshold", 0.0)
score_threshold = kwargs.get('score_threshold') if kwargs.get('score_threshold') else 0.0
lqhl marked this conversation as resolved.
Show resolved Hide resolved
crazywoola marked this conversation as resolved.
Show resolved Hide resolved
where_str = f"WHERE dist < {1 - score_threshold}" if \
self._metric.upper() == "COSINE" and order == SortOrder.ASC and score_threshold > 0.0 else ""
sql = f"""
Expand Down