From bf839676c71fd8d33b2b8023d2ce353ac30f0820 Mon Sep 17 00:00:00 2001 From: Mohammad Mohtashim <45242107+keenborder786@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:08:42 +0500 Subject: [PATCH] [Community]: FIxed the DocumentDBVectorSearch `_similarity_search_without_score` (#22970) - **Description:** The PR #22777 introduced a bug in `_similarity_search_without_score` which was raising the `OperationFailure` error. The mistake was syntax error for MongoDB pipeline which has been corrected now. - **Issue:** #22770 --- libs/community/langchain_community/vectorstores/documentdb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/community/langchain_community/vectorstores/documentdb.py b/libs/community/langchain_community/vectorstores/documentdb.py index d56f1a5712..730c517a15 100644 --- a/libs/community/langchain_community/vectorstores/documentdb.py +++ b/libs/community/langchain_community/vectorstores/documentdb.py @@ -328,8 +328,8 @@ class DocumentDBVectorSearch(VectorStore): A list of documents closest to the query vector """ pipeline: List[dict[str, Any]] = [ + {"$match": filter}, { - "$match": filter, "$search": { "vectorSearch": { "vector": embeddings, @@ -339,7 +339,7 @@ class DocumentDBVectorSearch(VectorStore): "efSearch": ef_search, } }, - } + }, ] cursor = self._collection.aggregate(pipeline)