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)
This commit is contained in:
cjpark-data 2024-02-09 05:06:42 +09:00 committed by GitHub
parent 9bb5157a3d
commit ce22e10c4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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