Toggle Menu
Prev Up Next

# `langchain.chains.combine_documents.reduce`.split_list_of_docs

langchain.chains.combine_documents.reduce.split_list_of_docs(docs: List[Document], length_func: Callable, token_max: int, **kwargs: Any) → List[List[Document]]

  Split Documents into subsets that each meet a cumulative length constraint.

  Parameters

    - docs (List[Document]) – The full list of Documents.

    - length_func (Callable) – Function for computing the cumulative length of a set of Documents.

    - token_max (int) – The maximum cumulative length of any subset of Documents.

    - **kwargs (Any) – Arbitrary additional keyword params to pass to each call of the length_func.

  Returns

    A List[List[Document]].

  Return type

    List[List[Document]]