擷取訊息批次結果
GET/v1/messages/batches/{message_batch_id}/results
以 .jsonl 檔案的形式串流傳輸訊息批次的結果。
檔案中的每一行都是一個 JSON 物件,包含訊息批次中單一請求的結果。結果的順序不保證與請求的順序相同。請使用 custom_id 欄位將結果與請求配對。
在我們的使用者指南中進一步瞭解 Message Batches API
Parameters
Returns
擷取訊息批次結果
require "anthropic"
anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key")
stream = anthropic.messages.batches.results_streaming("message_batch_id")
stream.each do |batch|
puts(batch)
end