Message Batches API, büyük hacimli mesajları asenkron olarak işlemenizi sağlar. Bu, toplu içerik üretimi, veri analizi veya batch işleme iş akışları gibi anında yanıt gerektirmeyen görevler için idealdir.
Organizasyonunuz için tüm mesaj gruplarını (batch) listeler.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._ListBatches);
Belirli bir grup hakkında bilgi alır.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatch('batch_id_here'));
Hâlâ işlenmekte olan bir grubu (batch) iptal eder.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._CancelBatch('batch_id_here'));
Tamamlanmış bir batch'in sonuçlarını alır.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatchResults('batch_id_here'));
Batch verilerine yapılandırılmış erişim için tipli yanıt sınıfını kullanın.
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;