TsgcHTTP_API_Anthropic方法 › ListBatches

ListBatches 方法

列出 Anthropic 工作区中的所有消息批次,支持可选分页

语法

function ListBatches(const aLimit: Integer = 20; const aAfterId: string = ''; const aBeforeId: string = '') : TsgcAnthropicClass_Response_List_Batches;

参数

名称类型描述
aLimitconst Integer每页返回的最大批次数量。默认值为 20。
aAfterIdconst stringCursor:返回在具有此 id 的批次之后创建的批次。首页时为空。
aBeforeIdconst string游标:返回在指定 ID 的批次之前创建的批次。留空表示忽略。

返回值

包含 Data 批量描述符数组和分页游标的响应(TsgcAnthropicClass_Response_List_Batches

备注

向 Anthropic Message Batches API 发送 GET /v1/messages/batches 请求,返回当前工作区提交的所有批次及其当前处理状态(in_progress、ended、canceled 等)。使用 aAfterId 可翻页查看后续内容。AnthropicOptions 中的 anthropic-version 请求头将自动附加。返回的对象必须由调用方释放。

示例

oResponse := oAPI.ListBatches(20);
try
  for i := 0 to oResponse.Data.Count - 1 do
    Memo1.Lines.Add(oResponse.Data[i].Id + ' = ' + oResponse.Data[i].ProcessingStatus);
finally
  oResponse.Free;
end;

返回方法