@@ -12,10 +12,11 @@ import { AnthropicError } from '../../../error';
1212
1313export class Batches extends APIResource {
1414 /**
15- * Send a batch of requests to create Messages .
15+ * Send a batch of Message creation requests .
1616 *
17- * The Messages Batch API can be used to process multiple Messages API requests at
18- * once. Once a Message Batch is created, it begins processing immediately.
17+ * The Message Batches API can be used to process multiple Messages API requests at
18+ * once. Once a Message Batch is created, it begins processing immediately. Batches
19+ * can take up to 24 hours to complete.
1920 */
2021 create ( params : BatchCreateParams , options ?: Core . RequestOptions ) : Core . APIPromise < BetaMessageBatch > {
2122 const { betas, ...body } = params ;
@@ -31,8 +32,8 @@ export class Batches extends APIResource {
3132
3233 /**
3334 * This endpoint is idempotent and can be used to poll for Message Batch
34- * completion. To access the results of a Message Batch, use the `responses_url`
35- * field in the response.
35+ * completion. To access the results of a Message Batch, make a request to the
36+ * `results_url` field in the response.
3637 */
3738 retrieve (
3839 messageBatchId : string ,
@@ -59,7 +60,8 @@ export class Batches extends APIResource {
5960 }
6061
6162 /**
62- * List all Message Batches within a Workspace.
63+ * List all Message Batches within a Workspace. Most recently created batches are
64+ * returned first.
6365 */
6466 list (
6567 params ?: BatchListParams ,
@@ -85,8 +87,15 @@ export class Batches extends APIResource {
8587 }
8688
8789 /**
88- * Batches may be canceled any time before processing ends. The system may complete
89- * any in-progress, non-interruptible operations before finalizing cancellation.
90+ * Batches may be canceled any time before processing ends. Once cancellation is
91+ * initiated, the batch enters a `canceling` state, at which time the system may
92+ * complete any in-progress, non-interruptible requests before finalizing
93+ * cancellation.
94+ *
95+ * The number of canceled requests is specified in `request_counts`. To determine
96+ * which requests were canceled, check the individual results within the batch.
97+ * Note that cancellation may not result in any canceled requests if they were
98+ * non-interruptible.
9099 */
91100 cancel (
92101 messageBatchId : string ,
@@ -168,6 +177,12 @@ export interface BetaMessageBatch {
168177 */
169178 id : string ;
170179
180+ /**
181+ * RFC 3339 datetime string representing the time at which the Message Batch was
182+ * archived and its results became unavailable.
183+ */
184+ archived_at : string | null ;
185+
171186 /**
172187 * RFC 3339 datetime string representing the time at which cancellation was
173188 * initiated for the Message Batch. Specified only if cancellation was initiated.
@@ -197,16 +212,15 @@ export interface BetaMessageBatch {
197212
198213 /**
199214 * Processing status of the Message Batch.
200- *
201- * This is one of: `in_progress`, `canceling`, or `ended`.
202215 */
203216 processing_status : 'in_progress' | 'canceling' | 'ended' ;
204217
205218 /**
206- * Overview of the number of requests within the Message Batch and their statuses .
219+ * Tallies requests within the Message Batch, categorized by their status .
207220 *
208221 * Requests start as `processing` and move to one of the other statuses only once
209- * processing of entire batch ends.
222+ * processing of the entire batch ends. The sum of all values always matches the
223+ * total number of requests in the batch.
210224 */
211225 request_counts : BetaMessageBatchRequestCounts ;
212226
@@ -244,7 +258,7 @@ export interface BetaMessageBatchExpiredResult {
244258export interface BetaMessageBatchIndividualResponse {
245259 /**
246260 * Developer-provided ID created for each request in a Message Batch. Useful for
247- * matching results to requests.
261+ * matching results to requests, as results may be given out of request order .
248262 *
249263 * Must be unique for each request within the Message Batch.
250264 */
@@ -331,7 +345,7 @@ export namespace BatchCreateParams {
331345 export interface Request {
332346 /**
333347 * Developer-provided ID created for each request in a Message Batch. Useful for
334- * matching results to requests.
348+ * matching results to requests, as results may be given out of request order .
335349 *
336350 * Must be unique for each request within the Message Batch.
337351 */
0 commit comments