LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicchainscombine_documentsreduceacollapse_docs
    Function●Since v1.0

    acollapse_docs

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

    Copy
    acollapse_docs(
      docs: list[Document],
      combine_document_func: AsyncCombineDocsProtocol,
      **kwargs: Any = {}
    ) -> Document

    Parameters

    NameTypeDescription
    docs*list[Document]

    A list of Document objects to combine.

    combine_document_func*AsyncCombineDocsProtocol

    A function that takes in a list of Document objects and optionally addition keyword parameters and combines them into a single string.

    **kwargsAny
    Default:{}

    Arbitrary additional keyword params to pass to the combine_document_func.

    View source on GitHub