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

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicchainscombine_documentsreduceReduceDocumentsChaincombine_docs
    Methodā—Since v1.0

    combine_docs

    Copy
    combine_docs(
      self,
      docs: list[Document],
      token_max: int | None = None
    View source on GitHub
    ,
    callbacks
    :
    Callbacks
    =
    None
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    ->
    tuple
    [
    str
    ,
    dict
    ]

    Parameters

    NameTypeDescription
    docs*list[Document]

    List of documents to combine, assumed that each one is less than token_max.

    token_maxint | None
    Default:None

    Recursively creates groups of documents less than this number of tokens.

    callbacksCallbacks
    Default:None
    **kwargsAny
    Default:{}

    Combine multiple documents recursively.

    Callbacks to be passed through

    additional parameters to be passed to LLM calls (like other input variables besides the documents)