def _get_chunks()

in pyrit/prompt_target/batch_helper.py [0:0]


def _get_chunks(*args, batch_size: int):
    """
    Helper function utilized during prompt batching to chunk based off of size.

    Args:
        *args: Arguments to chunk; each argument should be a list
        batch_size (int): Batch size

    """
    if len(args) == 0:
        raise ValueError("No arguments provided to chunk.")
    for arg in args[1:]:
        if len(arg) != len(args[0]):
            raise ValueError("All arguments must have the same length.")
    for i in range(0, len(args[0]), batch_size):
        yield [arg[i : i + batch_size] for arg in args]