Skip to content

Commit

Permalink
multi-retrival use dataset's top-k (langgenius#8416)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong authored and LLmoskk committed Sep 16, 2024
1 parent 30e0cb7 commit 33f6cba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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 @@ -426,7 +426,7 @@ def _retriever(self, flask_app: Flask, dataset_id: str, query: str, top_k: int,
retrieval_method=retrieval_model["search_method"],
dataset_id=dataset.id,
query=query,
top_k=top_k,
top_k=retrieval_model.get("top_k") or 2,
score_threshold=retrieval_model.get("score_threshold", 0.0)
if retrieval_model["score_threshold_enabled"]
else 0.0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,10 @@ def _retriever(
if dataset.indexing_technique == "economy":
# use keyword table query
documents = RetrievalService.retrieve(
retrieval_method="keyword_search", dataset_id=dataset.id, query=query, top_k=self.top_k
retrieval_method="keyword_search",
dataset_id=dataset.id,
query=query,
top_k=retrieval_model.get("top_k") or 2,
)
if documents:
all_documents.extend(documents)
Expand All @@ -176,7 +179,7 @@ def _retriever(
retrieval_method=retrieval_model["search_method"],
dataset_id=dataset.id,
query=query,
top_k=self.top_k,
top_k=retrieval_model.get("top_k") or 2,
score_threshold=retrieval_model.get("score_threshold", 0.0)
if retrieval_model["score_threshold_enabled"]
else 0.0,
Expand Down

0 comments on commit 33f6cba

Please sign in to comment.