TsgcHTTP_API_OpenAIMethods › ListBatches

ListBatches Method

Returns a paginated list of Batch jobs for the current organization

Syntax

function ListBatches(const aLimit: Integer = 20; const aAfter: string = '') : TsgcOpenAIClass_Response_List_Batches;

Parameters

NameTypeDescription
aLimitconst IntegerMaximum number of Batch jobs to return (1-100, defaults to 20).
aAfterconst stringCursor for forward pagination; pass the last Batch id from the previous page.

Return Value

Paginated list of Batch jobs with the HasMore flag for further iteration (TsgcOpenAIClass_Response_List_Batches)

Remarks

Calls GET /v1/batches to enumerate Batch jobs created under the current API key. Useful to build dashboards or to locate the id of a Batch previously submitted with CreateBatch.

Example

var oList: TsgcOpenAIClass_Response_List_Batches;
    i: Integer;
begin
  oList := oAPI.ListBatches(20);
  for i := 0 to oList.Data.Count - 1 do
    Memo1.Lines.Add(oList.Data[i].Id + ' - ' + oList.Data[i].Status);
end;

Back to Methods