Skip to content

Commit

Permalink
fixed score threshold is none
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong committed Sep 13, 2024
1 parent c78828a commit 43ac320
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/core/rag/datasource/retrieval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def retrieve(
dataset_id: str,
query: str,
top_k: int,
score_threshold: Optional[float] = 0.0,
score_threshold: Optional[float] = .0,
reranking_model: Optional[dict] = None,
reranking_mode: Optional[str] = "reranking_model",
weights: Optional[dict] = None,
Expand Down
2 changes: 1 addition & 1 deletion api/core/rag/retrieval/dataset_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def _retriever(self, flask_app: Flask, dataset_id: str, query: str, top_k: int,
top_k=top_k,
score_threshold=retrieval_model.get("score_threshold", 0.0)
if retrieval_model["score_threshold_enabled"]
else None,
else 0.0,
reranking_model=retrieval_model.get("reranking_model", None)
if retrieval_model["reranking_enable"]
else None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _retriever(
top_k=self.top_k,
score_threshold=retrieval_model.get("score_threshold", 0.0)
if retrieval_model["score_threshold_enabled"]
else None,
else 0.0,
reranking_model=retrieval_model.get("reranking_model", None)
if retrieval_model["reranking_enable"]
else None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _run(self, query: str) -> str:
top_k=self.top_k,
score_threshold=retrieval_model.get("score_threshold", 0.0)
if retrieval_model["score_threshold_enabled"]
else None,
else 0.0,
reranking_model=retrieval_model.get("reranking_model", None)
if retrieval_model["reranking_enable"]
else None,
Expand Down
2 changes: 1 addition & 1 deletion api/services/hit_testing_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def retrieve(cls, dataset: Dataset, query: str, account: Account, retrieval_mode
top_k=retrieval_model.get("top_k", 2),
score_threshold=retrieval_model.get("score_threshold", 0.0)
if retrieval_model["score_threshold_enabled"]
else None,
else 0.0,
reranking_model=retrieval_model.get("reranking_model", None)
if retrieval_model["reranking_enable"]
else None,
Expand Down

0 comments on commit 43ac320

Please sign in to comment.