Batch List API Does Not Support FIFO Ordering for Completed Batches

Description:
Currently, the batches.list() operation in the OpenAI Python SDK does not provide a way to retrieve completed batches in chronological order (oldest to newest). This limitation makes it difficult to process batch items sequentially in a First-In-First-Out (FIFO) manner.

Expected Behavior:

  • The API should return completed batches sorted from the oldest to newest, allowing applications to track the last processed batch and resume processing from that point.
  • A possible solution could involve supporting an order parameter (e.g., order='asc') or ensuring the default ordering is chronological.

Current Behavior:

  • The current API behavior returns batch items without a guaranteed ordering, making it challenging to implement efficient batch processing pipelines.
  • Even with pagination using after or limit, there is no documented way to ensure the correct processing order.