Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Fix the vector retrieval sorting issue (#6431)
leoterrydc847ba14544
diff --git a/api/core/rag/datasource/vdb/chroma/chroma_vector.py b/api/core/rag/datasource/vdb/chroma/chroma_vector.pyindex 1d85fa78c04..3629887b448 100644--- a/api/core/rag/datasource/vdb/chroma/chroma_vector.py+++ b/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 docsdef search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:diff --git a/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py b/api/core/rag/datasource/vdb/qdrant/qdrant_vector.pyindex c7c0b7f6f47..f9a93898683 100644--- a/api/core/rag/datasource/vdb/qdrant/qdrant_vector.py+++ b/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 docsdef search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]:diff --git a/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py b/api/core/rag/datasource/vdb/weaviate/weaviate_vector.pyindex 378d55472fc..87fc5ff158e 100644--- a/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py+++ b/api/core/rag/datasource/vdb/weaviate/weaviate_vector.py@@ -216,7 +216,8 @@ class WeaviateVector(BaseVector):if score > score_threshold:doc.metadata['score'] = scoredocs.append(doc)-+ # Sort the documents by score in descending order+ docs = sorted(docs, key=lambda x: x.metadata['score'], reverse=True)return docsdef search_by_full_text(self, query: str, **kwargs: Any) -> list[Document]: