mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-10 21:35:08 +00:00
Update parent_document_retriever.py about **kwargs (#22219)
Add kwargs in add_documents function **langchain**: Add **kwargs in parent_document_retriever" - **Add kwargs for `add_document` in `parent_document_retriever.py`** If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, ccurme, vbarda, hwchase17.
This commit is contained in:
parent
8dfa3c5f1a
commit
7496fe2b16
@ -1,5 +1,5 @@
|
||||
import uuid
|
||||
from typing import List, Optional, Sequence
|
||||
from typing import Any, List, Optional, Sequence
|
||||
|
||||
from langchain_core.documents import Document
|
||||
from langchain_text_splitters import TextSplitter
|
||||
@ -74,6 +74,7 @@ class ParentDocumentRetriever(MultiVectorRetriever):
|
||||
documents: List[Document],
|
||||
ids: Optional[List[str]] = None,
|
||||
add_to_docstore: bool = True,
|
||||
**kwargs: Any,
|
||||
) -> None:
|
||||
"""Adds documents to the docstore and vectorstores.
|
||||
|
||||
@ -119,6 +120,6 @@ class ParentDocumentRetriever(MultiVectorRetriever):
|
||||
_doc.metadata[self.id_key] = _id
|
||||
docs.extend(sub_docs)
|
||||
full_docs.append((_id, doc))
|
||||
self.vectorstore.add_documents(docs)
|
||||
self.vectorstore.add_documents(docs, **kwargs)
|
||||
if add_to_docstore:
|
||||
self.docstore.mset(full_docs)
|
||||
|
Loading…
Reference in New Issue
Block a user