acollapse_docs#

async langchain.chains.combine_documents.reduce.acollapse_docs(docs: List[Document], combine_document_func: AsyncCombineDocsProtocol, **kwargs: Any) β†’ Document[source]#

Execute a collapse function on a set of documents and merge their metadatas.

Parameters:
  • docs (List[Document]) – A list of Documents to combine.

  • combine_document_func (AsyncCombineDocsProtocol) – A function that takes in a list of Documents and optionally addition keyword parameters and combines them into a single string.

  • **kwargs (Any) – Arbitrary additional keyword params to pass to the combine_document_func.

Returns:

A single Document with the output of combine_document_func for the page content

and the combined metadata’s of all the input documents. All metadata values are strings, and where there are overlapping keys across documents the values are joined by β€œ, β€œ.

Return type:

Document

Examples using acollapse_docs