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

    Chat LangChain

    What can I help with?

    Enter to sendยทShift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicchainscombine_documentsreduceacollapse_docs
    Functionโ—Since v1.5

    acollapse_docs

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

    Parameters

    NameTypeDescription
    docs*list[Document]
    combine_document_func*AsyncCombineDocsProtocol
    **kwargsAny
    Default:{}

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

    A list of Document objects to combine.

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

    Arbitrary additional keyword params to pass to the combine_document_func.