Anthropic | Berichtbatches

Met de Message Batches API kunt u grote hoeveelheden berichten asynchroon verwerken. Dit is ideaal voor taken waarbij geen onmiddellijke respons vereist is, zoals het bulkgenereren van inhoud, gegevensanalyse of batchverwerkingsworkflows.

Batches weergeven

Geeft een lijst van alle berichtbatches voor uw organisatie.


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

Batch ophalen

Retrieves information about a specific batch.


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

Batch Annuleren

Annuleert een batch die nog wordt verwerkt.


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

Batchresultaten ophalen

Retrieves the results of a completed batch.


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

Getypeerd antwoord

Gebruik de getypte antwoordklasse voor gestructureerde toegang tot batchgegevens.


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;