node-ejs-renderer/node_modules/openai/resources/fine-tuning/jobs/jobs.js
2024-06-09 13:55:01 -04:00

93 lines
3.8 KiB
JavaScript

"use strict";
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FineTuningJobEventsPage = exports.FineTuningJobsPage = exports.Jobs = void 0;
const resource_1 = require("../../../resource.js");
const core_1 = require("../../../core.js");
const JobsAPI = __importStar(require("./jobs.js"));
const CheckpointsAPI = __importStar(require("./checkpoints.js"));
const pagination_1 = require("../../../pagination.js");
class Jobs extends resource_1.APIResource {
constructor() {
super(...arguments);
this.checkpoints = new CheckpointsAPI.Checkpoints(this._client);
}
/**
* Creates a fine-tuning job which begins the process of creating a new model from
* a given dataset.
*
* Response includes details of the enqueued job including job status and the name
* of the fine-tuned models once complete.
*
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
*/
create(body, options) {
return this._client.post('/fine_tuning/jobs', { body, ...options });
}
/**
* Get info about a fine-tuning job.
*
* [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)
*/
retrieve(fineTuningJobId, options) {
return this._client.get(`/fine_tuning/jobs/${fineTuningJobId}`, options);
}
list(query = {}, options) {
if ((0, core_1.isRequestOptions)(query)) {
return this.list({}, query);
}
return this._client.getAPIList('/fine_tuning/jobs', FineTuningJobsPage, { query, ...options });
}
/**
* Immediately cancel a fine-tune job.
*/
cancel(fineTuningJobId, options) {
return this._client.post(`/fine_tuning/jobs/${fineTuningJobId}/cancel`, options);
}
listEvents(fineTuningJobId, query = {}, options) {
if ((0, core_1.isRequestOptions)(query)) {
return this.listEvents(fineTuningJobId, {}, query);
}
return this._client.getAPIList(`/fine_tuning/jobs/${fineTuningJobId}/events`, FineTuningJobEventsPage, {
query,
...options,
});
}
}
exports.Jobs = Jobs;
class FineTuningJobsPage extends pagination_1.CursorPage {
}
exports.FineTuningJobsPage = FineTuningJobsPage;
class FineTuningJobEventsPage extends pagination_1.CursorPage {
}
exports.FineTuningJobEventsPage = FineTuningJobEventsPage;
(function (Jobs) {
Jobs.FineTuningJobsPage = JobsAPI.FineTuningJobsPage;
Jobs.FineTuningJobEventsPage = JobsAPI.FineTuningJobEventsPage;
Jobs.Checkpoints = CheckpointsAPI.Checkpoints;
Jobs.FineTuningJobCheckpointsPage = CheckpointsAPI.FineTuningJobCheckpointsPage;
})(Jobs = exports.Jobs || (exports.Jobs = {}));
//# sourceMappingURL=jobs.js.map