TsgcHTTP_API_Anthropic方法 › CancelBatch

CancelBatch 方法

取消 Anthropic API 上正在进行的消息批处理。

语法

function CancelBatch(const aBatchId: string) : TsgcAnthropicClass_Response_Batch;

参数

名称类型描述
aBatchIdconst string要取消的批次标识符,通常以 msgbatch_ 开头。

返回值

已更新的批处理描述符,其 ProcessingStatus 已设置为 canceling 或 ended。(TsgcAnthropicClass_Response_Batch

备注

向 Anthropic API 发送 POST /v1/messages/batches/{id}/cancel 请求。批次中已开始处理的请求仍将计费;未处理的请求将被中止。来自 AnthropicOptionsanthropic-version 请求头将自动包含在内。调用方负责释放返回的对象。

示例

oResponse := oAPI.CancelBatch('msgbatch_01AbCdEf');
try
  ShowMessage('new status: ' + oResponse.ProcessingStatus);
finally
  oResponse.Free;
end;

返回方法