TsgcHTTP_API_OpenAI › Methods › CancelBatch
Cancels a Batch job that has not yet completed
function CancelBatch(const aBatchId: string) : TsgcOpenAIClass_Response_Batch;
| Name | Type | Description |
|---|---|---|
aBatchId | const string | The identifier of the Batch job to cancel. |
The Batch object with its status advanced to cancelling (or cancelled for short batches) (TsgcOpenAIClass_Response_Batch)
Calls POST /v1/batches/{batch_id}/cancel. Cancellation is best effort and may take up to 10 minutes; requests already completed remain in the output file while any pending requests are discarded. Poll RetrieveBatch to observe the final state.
var oBatch: TsgcOpenAIClass_Response_Batch;
begin
oBatch := oAPI.CancelBatch('batch_abc123');
ShowMessage('Status: ' + oBatch.Status);
end;