TsgcHTTP_API_OpenAIMethods › CancelBatch

CancelBatch Method

Cancels a Batch job that has not yet completed

Syntax

function CancelBatch(const aBatchId: string) : TsgcOpenAIClass_Response_Batch;

Parameters

NameTypeDescription
aBatchIdconst stringThe identifier of the Batch job to cancel.

Return Value

The Batch object with its status advanced to cancelling (or cancelled for short batches) (TsgcOpenAIClass_Response_Batch)

Remarks

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.

Example

var oBatch: TsgcOpenAIClass_Response_Batch;
begin
  oBatch := oAPI.CancelBatch('batch_abc123');
  ShowMessage('Status: ' + oBatch.Status);
end;

Back to Methods