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 Cognesy\Polyglot\BatchInference\Config\BatchConfig;
use Cognesy\Polyglot\BatchInference\Exceptions\UnsupportedBatchOperation;
use Cognesy\Polyglot\Inference\Config\LLMConfig;
use Examples\BatchInference\Support\DemoBatch;
$directDeepSeekRejected = false;
try {
BatchConfig::fromLLMConfig(new LLMConfig(
apiUrl: 'https://api.deepseek.com', model: 'deepseek-chat', driver: 'deepseek',
));
} catch (InvalidArgumentException $error) {
$directDeepSeekRejected = true;
}
$batches = DemoBatch::client(canCancel: false);
$cancelRejected = false;
try {
$batches->cancel(DemoBatch::reference());
} catch (UnsupportedBatchOperation $error) {
$cancelRejected = true;
}
if (!$directDeepSeekRejected || !$cancelRejected || $batches->capabilities()->canCancel()) {
throw new RuntimeException('Unsupported batch capability was not rejected.');
}
echo "Direct DeepSeek batch and unsupported cancellation rejected locally\n";
?>