TsgcHTTP_API_Anthropic › 方法 › CancelBatch
取消 Anthropic API 上正在进行的消息批处理。
function CancelBatch(const aBatchId: string) : TsgcAnthropicClass_Response_Batch;
| 名称 | 类型 | 描述 |
|---|---|---|
aBatchId | const string | 要取消的批次标识符,通常以 msgbatch_ 开头。 |
已更新的批处理描述符,其 ProcessingStatus 已设置为 canceling 或 ended。(TsgcAnthropicClass_Response_Batch)
向 Anthropic API 发送 POST /v1/messages/batches/{id}/cancel 请求。批次中已开始处理的请求仍将计费;未处理的请求将被中止。来自 AnthropicOptions 的 anthropic-version 请求头将自动包含在内。调用方负责释放返回的对象。
oResponse := oAPI.CancelBatch('msgbatch_01AbCdEf');
try
ShowMessage('new status: ' + oResponse.ProcessingStatus);
finally
oResponse.Free;
end;