openai
Version:
The official TypeScript library for the OpenAI API
41 lines • 1.49 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.BatchesPage = exports.Batches = void 0;
const resource_1 = require("../resource.js");
const core_1 = require("../core.js");
const pagination_1 = require("../pagination.js");
class Batches extends resource_1.APIResource {
/**
* Creates and executes a batch from an uploaded file of requests
*/
create(body, options) {
return this._client.post('/batches', { body, ...options });
}
/**
* Retrieves a batch.
*/
retrieve(batchId, options) {
return this._client.get(`/batches/${batchId}`, options);
}
list(query = {}, options) {
if ((0, core_1.isRequestOptions)(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/batches', BatchesPage, { query, ...options });
}
/**
* 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.
*/
cancel(batchId, options) {
return this._client.post(`/batches/${batchId}/cancel`, options);
}
}
exports.Batches = Batches;
class BatchesPage extends pagination_1.CursorPage {
}
exports.BatchesPage = BatchesPage;
Batches.BatchesPage = BatchesPage;
//# sourceMappingURL=batches.js.map
;