소스 검색

Fix the vector retrieval sorting issue (#6431)

Co-authored-by: weifj <“weifj@tuyuansu.com.cn”>
tags/0.6.15
leoterry 1 년 전
부모
커밋
dc847ba145
No account linked to committer's email address

+ 2
- 1
api/core/rag/datasource/vdb/chroma/chroma_vector.py 파일 보기

@@ -111,7 +111,8 @@ class ChromaVector(BaseVector):
metadata=metadata,
)
docs.append(doc)

# Sort the documents by score in descending order
docs = sorted(docs, key=lambda x: x.metadata['score'], reverse=True)
return docs

def search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:

+ 2
- 0
api/core/rag/datasource/vdb/qdrant/qdrant_vector.py 파일 보기

@@ -362,6 +362,8 @@ class QdrantVector(BaseVector):
metadata=metadata,
)
docs.append(doc)
# Sort the documents by score in descending order
docs = sorted(docs, key=lambda x: x.metadata['score'], reverse=True)
return docs

def search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:

+ 2
- 1
api/core/rag/datasource/vdb/weaviate/weaviate_vector.py 파일 보기

@@ -216,7 +216,8 @@ class WeaviateVector(BaseVector):
if score > score_threshold:
doc.metadata['score'] = score
docs.append(doc)

# Sort the documents by score in descending order
docs = sorted(docs, key=lambda x: x.metadata['score'], reverse=True)
return docs

def search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:

Loading…
취소
저장