mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 13:00:34 +00:00
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:
parent
040271f33a
commit
df234fb171
@ -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
|
||||
|
@ -19,8 +19,10 @@ os.environ["OPENAI_API_KEY"] = "sk-xxxx"
|
||||
context_value = [
|
||||
{
|
||||
"context": "this document is about John",
|
||||
"source": "source#1",
|
||||
"document_id": 123,
|
||||
"metadata": {
|
||||
"source": "source#1",
|
||||
"doc_id": 123,
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user