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.
Listet alle Nachrichten-Batches für Ihre Organisation auf.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._ListBatches);
Ruft Informationen über einen bestimmten Batch ab.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatch('batch_id_here'));
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'));
Ruft die Ergebnisse eines abgeschlossenen Batches ab.
Anthropic := TsgcHTTP_API_Anthropic.Create(nil);
Anthropic.AnthropicOptions.ApiKey := 'API_KEY';
WriteLn(Anthropic._GetBatchResults('batch_id_here'));
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;