NumPy allowed · plain Python earns 10 bonus points
Cosine-like similarity scores ranked before context assembly
Partition a flat list into fixed-size batches -- the standard pattern used in LLM prompt batching, database bulk insertion, and mini-batch gradient descent.
Implement chunk_list(items, chunk_size): partition items into sublists of length chunk_size. The final chunk contains the remaining elements if len(items) is not evenly divisible. Raise ValueError if chunk_size <= 0. If items is empty, return [].
chunk_list(items: list, chunk_size: int) -> list[list]