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_documentsreducesplit_list_of_docs
    Function●Since v1.0

    split_list_of_docs

    Split Document objects to subsets that each meet a cumulative len. constraint.

    Copy
    split_list_of_docs(
      docs: list[Document],
      length_func: Callable,
      token_max: int,
      **kwargs: Any = {}
    ) -> list[list[Document]]

    Parameters

    NameTypeDescription
    docs*list[Document]

    The full list of Document objects.

    length_func*Callable

    Function for computing the cumulative length of a set of Document objects.

    token_max*int

    The maximum cumulative length of any subset of Document objects.

    **kwargsAny
    Default:{}

    Arbitrary additional keyword params to pass to each call of the length_func.

    View source on GitHub