Message Batches API를 사용하면 대량의 메시지를 비동기적으로 처리할 수 있습니다. 이는 대량 콘텐츠 생성, 데이터 분석 또는 배치 처리 워크플로와 같이 즉각적인 응답이 필요하지 않은 작업에 이상적입니다.
조직의 모든 메시지 batch를 나열합니다.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._ListBatches);
특정 배치에 대한 정보를 검색합니다.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatch('batch_id_here'));
여전히 처리 중인 batch를 취소합니다.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._CancelBatch('batch_id_here'));
완료된 배치의 결과를 검색합니다.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatchResults('batch_id_here'));
배치 데이터에 대한 구조화된 액세스를 위해 형식화된 응답 클래스를 사용하십시오.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
oBatches := Anthropic.ListBatches;
Try
for i := 0 to Length(oBatches.Batches) - 1 do
WriteLn(oBatches.Batches[i].Id + ' - ' + oBatches.Batches[i].ProcessingStatus);
Finally
oBatches.Free;
End;