Skip to content

The agent engineering platform.

community[patch]: Fix KeyError 'embedding' (MongoDBAtlasVectorSearch) (#17178)

cjpark-datace22e10c4b18
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