From 91fd8521c3f5f9d9d8bbbe791f4c0c9facc0a267 Mon Sep 17 00:00:00 2001 From: Jyong <76649700+JohnJyong@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:07:55 +0800 Subject: [PATCH] fix reranking model field error (#6654) --- api/core/workflow/nodes/knowledge_retrieval/entities.py | 4 ++-- .../nodes/knowledge_retrieval/knowledge_retrieval_node.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/core/workflow/nodes/knowledge_retrieval/entities.py b/api/core/workflow/nodes/knowledge_retrieval/entities.py index 5a9a4a9009d97b..5758b895f30cc9 100644 --- a/api/core/workflow/nodes/knowledge_retrieval/entities.py +++ b/api/core/workflow/nodes/knowledge_retrieval/entities.py @@ -46,8 +46,8 @@ class MultipleRetrievalConfig(BaseModel): score_threshold: Optional[float] = None reranking_mode: str = 'reranking_model' reranking_enable: bool = True - reranking_model: RerankingModelConfig - weights: WeightedScoreConfig + reranking_model: Optional[RerankingModelConfig] = None + weights: Optional[WeightedScoreConfig] = None class ModelConfig(BaseModel): diff --git a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py index 5f8966f880e53a..7a2b3c85125df9 100644 --- a/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py +++ b/api/core/workflow/nodes/knowledge_retrieval/knowledge_retrieval_node.py @@ -140,8 +140,8 @@ def _fetch_dataset_retriever(self, node_data: KnowledgeRetrievalNodeData, query: elif node_data.retrieval_mode == DatasetRetrieveConfigEntity.RetrieveStrategy.MULTIPLE.value: if node_data.multiple_retrieval_config.reranking_mode == 'reranking_model': reranking_model = { - 'reranking_provider_name': node_data.multiple_retrieval_config.reranking_model['provider'], - 'reranking_model_name': node_data.multiple_retrieval_config.reranking_model['name'] + 'reranking_provider_name': node_data.multiple_retrieval_config.reranking_model.provider, + 'reranking_model_name': node_data.multiple_retrieval_config.reranking_model.model } weights = None elif node_data.multiple_retrieval_config.reranking_mode == 'weighted_score':