From ce22e10c4b18b9706bf6630c248e29597a86a583 Mon Sep 17 00:00:00 2001 From: cjpark-data <127289188+cjpark-data@users.noreply.github.com> Date: Fri, 9 Feb 2024 05:06:42 +0900 Subject: [PATCH] community[patch]: Fix KeyError 'embedding' (MongoDBAtlasVectorSearch) (#17178) - **Description:** Embedding field name was hard-coded named "embedding". So I suggest that change `res["embedding"]` into `res[self._embedding_key]`. - **Issue:** #17177, - **Twitter handle:** [@bagcheoljun17](https://twitter.com/bagcheoljun17) --- .../community/langchain_community/vectorstores/mongodb_atlas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/community/langchain_community/vectorstores/mongodb_atlas.py b/libs/community/langchain_community/vectorstores/mongodb_atlas.py index c105e6f536..2e18f4280f 100644 --- a/libs/community/langchain_community/vectorstores/mongodb_atlas.py +++ b/libs/community/langchain_community/vectorstores/mongodb_atlas.py @@ -209,7 +209,7 @@ class MongoDBAtlasVectorSearch(VectorStore): for res in cursor: text = res.pop(self._text_key) score = res.pop("score") - del res["embedding"] + del res[self._embedding_key] docs.append((Document(page_content=text, metadata=res), score)) return docs