Anthropic | Message Batches

Die Message Batches API ermöglicht es Ihnen, große Mengen von Nachrichten asynchron zu verarbeiten. Dies ist ideal für Aufgaben, die keine sofortigen Antworten erfordern, wie die Massengenerierung von Inhalten, Datenanalysen oder Batch-Verarbeitungsabläufe.

List Batches

Listet alle Nachrichten-Batches für Ihre Organisation auf.


Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._ListBatches);

Get Batch

Ruft Informationen über einen bestimmten Batch ab.


Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatch('batch_id_here'));

Batch abbrechen

Bricht einen Batch ab, der noch verarbeitet wird.


Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._CancelBatch('batch_id_here'));

Get Batch Results

Ruft die Ergebnisse eines abgeschlossenen Batches ab.


Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatchResults('batch_id_here'));

Typisierte Antwort

Verwenden Sie die typisierte Antwortklasse für strukturierten Zugriff auf Batch-Daten.


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;