Method: OpenAI::Resources::Batches#cancel

Defined in:
lib/openai/resources/batches.rb

#cancel(batch_id, request_options: {}) ⇒ OpenAI::Models::Batch

Cancels an in-progress batch. The batch will be in status cancelling for up to 10 minutes, before changing to cancelled, where it will have partial results (if any) available in the output file.

Parameters:

  • batch_id (String)

    The ID of the batch to cancel.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



92
93
94
95
96
97
98
99
# File 'lib/openai/resources/batches.rb', line 92

def cancel(batch_id, params = {})
  @client.request(
    method: :post,
    path: ["batches/%1$s/cancel", batch_id],
    model: OpenAI::Batch,
    options: params[:request_options]
  )
end