Skip to content

Commit

Permalink
fix rerank model value is empty string (langgenius#7937)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnJyong authored and cuiks committed Sep 26, 2024
1 parent f3cdec9 commit 219f8ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/core/rag/datasource/retrieval_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def embedding_search(cls, flask_app: Flask, dataset_id: str, query: str,
)

if documents:
if reranking_model and retrival_method == RetrievalMethod.SEMANTIC_SEARCH.value:
if reranking_model and reranking_model.get('reranking_model_name') and reranking_model.get('reranking_provider_name') and retrival_method == RetrievalMethod.SEMANTIC_SEARCH.value:
data_post_processor = DataPostProcessor(str(dataset.tenant_id),
RerankMode.RERANKING_MODEL.value,
reranking_model, None, False)
Expand Down Expand Up @@ -180,7 +180,7 @@ def full_text_index_search(cls, flask_app: Flask, dataset_id: str, query: str,
top_k=top_k
)
if documents:
if reranking_model and retrival_method == RetrievalMethod.FULL_TEXT_SEARCH.value:
if reranking_model and reranking_model.get('reranking_model_name') and reranking_model.get('reranking_provider_name') and retrival_method == RetrievalMethod.FULL_TEXT_SEARCH.value:
data_post_processor = DataPostProcessor(str(dataset.tenant_id),
RerankMode.RERANKING_MODEL.value,
reranking_model, None, False)
Expand Down

0 comments on commit 219f8ed

Please sign in to comment.