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]][source]ΒΆ

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

Parameters
  • docs – The full list of Documents.

  • length_func – Function for computing the cumulative length of a set of Documents.

  • token_max – The maximum cumulative length of any subset of Documents.

  • **kwargs – Arbitrary additional keyword params to pass to each call of the length_func.

Returns

A List[List[Document]].