diff --git a/api/core/model_providers/models/reranking/xinference_reranking.py b/api/core/model_providers/models/reranking/xinference_reranking.py index 0efcf189f01d0c..47c1c6cd01edba 100644 --- a/api/core/model_providers/models/reranking/xinference_reranking.py +++ b/api/core/model_providers/models/reranking/xinference_reranking.py @@ -1,12 +1,11 @@ import logging -from typing import Optional, List - -from langchain.schema import Document -from xinference_client.client.restful.restful_client import Client +from typing import List, Optional from core.model_providers.error import LLMBadRequestError from core.model_providers.models.reranking.base import BaseReranking from core.model_providers.providers.base import BaseModelProvider +from langchain.schema import Document +from xinference_client.client.restful.restful_client import Client class XinferenceReranking(BaseReranking): @@ -48,7 +47,7 @@ def rerank(self, query: str, documents: List[Document], score_threshold: Optiona ) # score threshold check if score_threshold is not None: - if result.relevance_score >= score_threshold: + if result['relevance_score'] >= score_threshold: rerank_documents.append(rerank_document) else: rerank_documents.append(rerank_document)