community[patch]: Fixing embedchain document mapping (#18255)

- **Description:** The current embedchain implementation seems to handle
document metadata differently than done in the current implementation of
langchain and a KeyError is thrown. I would love for someone else to
test this...

---------

Co-authored-by: KKUGLER <kai.kugler@mercedes-benz.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
Co-authored-by: Deshraj Yadav <deshraj@gatech.edu>
This commit is contained in:
Kai Kugler
2024-02-29 23:54:37 +01:00
committed by GitHub
parent 040271f33a
commit df234fb171
2 changed files with 8 additions and 3 deletions

View File

@@ -65,7 +65,10 @@ class EmbedchainRetriever(BaseRetriever):
docs.append(
Document(
page_content=r["context"],
metadata={"source": r["source"], "document_id": r["document_id"]},
metadata={
"source": r["metadata"]["url"],
"document_id": r["metadata"]["doc_id"],
},
)
)
return docs