batch_iterate#
- langchain_core.utils.iter.batch_iterate(size: int | None, iterable: Iterable[T]) Iterator[list[T]] [source]#
Utility batching function.
- Parameters:
size (int | None) – The size of the batch. If None, returns a single batch.
iterable (Iterable[T]) – The iterable to batch.
- Yields:
The batches of the iterable.
- Return type:
Iterator[list[T]]