split_list_of_docs#
- langchain.chains.combine_documents.reduce.split_list_of_docs(
- docs: list[Document],
- length_func: Callable,
- token_max: int,
- **kwargs: Any,
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]]
Examples using split_list_of_docs