B09_BatchInference
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
<?php
require 'examples/boot.php';
require __DIR__.'/../Support/DemoBatch.php';
use Examples\BatchInference\Support\DemoBatch;
$batches = DemoBatch::client();
$first = $batches->listJobs(limit: 2);
$ids = array_map(
static fn ($job): string => $job->reference()->id()->toString(),
iterator_to_array($first->jobs()),
);
$second = $batches->listJobs(limit: 2, cursor: $first->nextCursor());
if ($ids !== ['batch-example'] || $first->nextCursor() === null
|| iterator_count($second->jobs()) !== 0 || $second->nextCursor() !== null) {
throw new RuntimeException('Batch listing cursor did not advance.');
}
echo "Listed one job; continuation page is empty\n";
?>