openai 4.0.1 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/_shims/fetch.d.ts +1 -0
- package/_shims/fetch.node.d.ts +1 -0
- package/core.js +1 -1
- package/core.js.map +1 -1
- package/core.mjs +1 -1
- package/core.mjs.map +1 -1
- package/index.d.mts +3 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/index.mjs +2 -0
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/chat/completions.d.ts +5 -4
- package/resources/chat/completions.d.ts.map +1 -1
- package/resources/chat/completions.js.map +1 -1
- package/resources/chat/completions.mjs.map +1 -1
- package/resources/completions.d.ts +7 -4
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.js.map +1 -1
- package/resources/completions.mjs.map +1 -1
- package/resources/files.d.ts +2 -4
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js.map +1 -1
- package/resources/files.mjs.map +1 -1
- package/resources/fine-tunes.d.ts +25 -18
- package/resources/fine-tunes.d.ts.map +1 -1
- package/resources/fine-tunes.js +2 -2
- package/resources/fine-tunes.js.map +1 -1
- package/resources/fine-tunes.mjs +2 -2
- package/resources/fine-tunes.mjs.map +1 -1
- package/resources/fine-tuning/fine-tuning.d.ts +17 -0
- package/resources/fine-tuning/fine-tuning.d.ts.map +1 -0
- package/resources/fine-tuning/fine-tuning.js +60 -0
- package/resources/fine-tuning/fine-tuning.js.map +1 -0
- package/resources/fine-tuning/fine-tuning.mjs +16 -0
- package/resources/fine-tuning/fine-tuning.mjs.map +1 -0
- package/resources/fine-tuning/index.d.ts +12 -0
- package/resources/fine-tuning/index.d.ts.map +1 -0
- package/resources/fine-tuning/index.js +31 -0
- package/resources/fine-tuning/index.js.map +1 -0
- package/resources/fine-tuning/index.mjs +4 -0
- package/resources/fine-tuning/index.mjs.map +1 -0
- package/resources/fine-tuning/jobs.d.ts +225 -0
- package/resources/fine-tuning/jobs.d.ts.map +1 -0
- package/resources/fine-tuning/jobs.js +62 -0
- package/resources/fine-tuning/jobs.js.map +1 -0
- package/resources/fine-tuning/jobs.mjs +56 -0
- package/resources/fine-tuning/jobs.mjs.map +1 -0
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +8 -0
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/src/_shims/fetch.d.ts +1 -0
- package/src/_shims/fetch.node.d.ts +1 -0
- package/src/core.ts +1 -1
- package/src/index.ts +5 -0
- package/src/resources/chat/completions.ts +6 -4
- package/src/resources/completions.ts +8 -4
- package/src/resources/files.ts +2 -4
- package/src/resources/fine-tunes.ts +26 -18
- package/src/resources/fine-tuning/fine-tuning.ts +20 -0
- package/src/resources/fine-tuning/index.ts +13 -0
- package/src/resources/fine-tuning/jobs.ts +293 -0
- package/src/resources/index.ts +1 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
exports.FineTuningJobEventsPage = exports.FineTuningJobsPage = exports.Jobs = void 0;
|
|
5
|
+
const resource_1 = require('openai/resource');
|
|
6
|
+
const core_1 = require('openai/core');
|
|
7
|
+
const pagination_1 = require('openai/pagination');
|
|
8
|
+
class Jobs extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a job that fine-tunes a specified model from a given dataset.
|
|
11
|
+
*
|
|
12
|
+
* Response includes details of the enqueued job including job status and the name
|
|
13
|
+
* of the fine-tuned models once complete.
|
|
14
|
+
*
|
|
15
|
+
* [Learn more about fine-tuning](/docs/guides/fine-tuning)
|
|
16
|
+
*/
|
|
17
|
+
create(body, options) {
|
|
18
|
+
return this.post('/fine_tuning/jobs', { body, ...options });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get info about a fine-tuning job.
|
|
22
|
+
*
|
|
23
|
+
* [Learn more about fine-tuning](/docs/guides/fine-tuning)
|
|
24
|
+
*/
|
|
25
|
+
retrieve(fineTuningJobId, options) {
|
|
26
|
+
return this.get(`/fine_tuning/jobs/${fineTuningJobId}`, options);
|
|
27
|
+
}
|
|
28
|
+
list(query = {}, options) {
|
|
29
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
30
|
+
return this.list({}, query);
|
|
31
|
+
}
|
|
32
|
+
return this.getAPIList('/fine_tuning/jobs', FineTuningJobsPage, { query, ...options });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Immediately cancel a fine-tune job.
|
|
36
|
+
*/
|
|
37
|
+
cancel(fineTuningJobId, options) {
|
|
38
|
+
return this.post(`/fine_tuning/jobs/${fineTuningJobId}/cancel`, options);
|
|
39
|
+
}
|
|
40
|
+
listEvents(fineTuningJobId, query = {}, options) {
|
|
41
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
42
|
+
return this.listEvents(fineTuningJobId, {}, query);
|
|
43
|
+
}
|
|
44
|
+
return this.getAPIList(`/fine_tuning/jobs/${fineTuningJobId}/events`, FineTuningJobEventsPage, {
|
|
45
|
+
query,
|
|
46
|
+
...options,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Jobs = Jobs;
|
|
51
|
+
/**
|
|
52
|
+
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
53
|
+
*/
|
|
54
|
+
class FineTuningJobsPage extends pagination_1.Page {}
|
|
55
|
+
exports.FineTuningJobsPage = FineTuningJobsPage;
|
|
56
|
+
/**
|
|
57
|
+
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
58
|
+
*/
|
|
59
|
+
class FineTuningJobEventsPage extends pagination_1.Page {}
|
|
60
|
+
exports.FineTuningJobEventsPage = FineTuningJobEventsPage;
|
|
61
|
+
(function (Jobs) {})((Jobs = exports.Jobs || (exports.Jobs = {})));
|
|
62
|
+
//# sourceMappingURL=jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/resources/fine-tuning/jobs.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;AAC9C,sCAA+C;AAG/C,kDAAyC;AAEzC,MAAa,IAAK,SAAQ,sBAAW;IACnC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAqB,EAAE,OAA6B;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,eAAuB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,qBAAqB,eAAe,EAAE,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAUD,IAAI,CACF,QAA6C,EAAE,EAC/C,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,eAAe,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAcD,UAAU,CACR,eAAuB,EACvB,QAAmD,EAAE,EACrD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACpD;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,qBAAqB,eAAe,SAAS,EAAE,uBAAuB,EAAE;YAC7F,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AAxED,oBAwEC;AAED;;GAEG;AACH,MAAa,kBAAmB,SAAQ,iBAAmB;CAAG;AAA9D,gDAA8D;AAI9D;;GAEG;AACH,MAAa,uBAAwB,SAAQ,iBAAwB;CAAG;AAAxE,0DAAwE;AA+LxE,WAAiB,IAAI;AAQrB,CAAC,EARgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAQpB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
import { APIResource } from 'openai/resource';
|
|
3
|
+
import { isRequestOptions } from 'openai/core';
|
|
4
|
+
import { Page } from 'openai/pagination';
|
|
5
|
+
export class Jobs extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a job that fine-tunes a specified model from a given dataset.
|
|
8
|
+
*
|
|
9
|
+
* Response includes details of the enqueued job including job status and the name
|
|
10
|
+
* of the fine-tuned models once complete.
|
|
11
|
+
*
|
|
12
|
+
* [Learn more about fine-tuning](/docs/guides/fine-tuning)
|
|
13
|
+
*/
|
|
14
|
+
create(body, options) {
|
|
15
|
+
return this.post('/fine_tuning/jobs', { body, ...options });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get info about a fine-tuning job.
|
|
19
|
+
*
|
|
20
|
+
* [Learn more about fine-tuning](/docs/guides/fine-tuning)
|
|
21
|
+
*/
|
|
22
|
+
retrieve(fineTuningJobId, options) {
|
|
23
|
+
return this.get(`/fine_tuning/jobs/${fineTuningJobId}`, options);
|
|
24
|
+
}
|
|
25
|
+
list(query = {}, options) {
|
|
26
|
+
if (isRequestOptions(query)) {
|
|
27
|
+
return this.list({}, query);
|
|
28
|
+
}
|
|
29
|
+
return this.getAPIList('/fine_tuning/jobs', FineTuningJobsPage, { query, ...options });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Immediately cancel a fine-tune job.
|
|
33
|
+
*/
|
|
34
|
+
cancel(fineTuningJobId, options) {
|
|
35
|
+
return this.post(`/fine_tuning/jobs/${fineTuningJobId}/cancel`, options);
|
|
36
|
+
}
|
|
37
|
+
listEvents(fineTuningJobId, query = {}, options) {
|
|
38
|
+
if (isRequestOptions(query)) {
|
|
39
|
+
return this.listEvents(fineTuningJobId, {}, query);
|
|
40
|
+
}
|
|
41
|
+
return this.getAPIList(`/fine_tuning/jobs/${fineTuningJobId}/events`, FineTuningJobEventsPage, {
|
|
42
|
+
query,
|
|
43
|
+
...options,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
49
|
+
*/
|
|
50
|
+
export class FineTuningJobsPage extends Page {}
|
|
51
|
+
/**
|
|
52
|
+
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
|
53
|
+
*/
|
|
54
|
+
export class FineTuningJobEventsPage extends Page {}
|
|
55
|
+
(function (Jobs) {})(Jobs || (Jobs = {}));
|
|
56
|
+
//# sourceMappingURL=jobs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.mjs","sourceRoot":"","sources":["../../src/resources/fine-tuning/jobs.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;OACtC,EAAE,gBAAgB,EAAE,MAAM,aAAa;OAGvC,EAAE,IAAI,EAAE,MAAM,mBAAmB;AAExC,MAAM,OAAO,IAAK,SAAQ,WAAW;IACnC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAqB,EAAE,OAA6B;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,eAAuB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,qBAAqB,eAAe,EAAE,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAUD,IAAI,CACF,QAA6C,EAAE,EAC/C,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,mBAAmB,EAAE,kBAAkB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,qBAAqB,eAAe,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAcD,UAAU,CACR,eAAuB,EACvB,QAAmD,EAAE,EACrD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACpD;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,qBAAqB,eAAe,SAAS,EAAE,uBAAuB,EAAE;YAC7F,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAmB;CAAG;AAI9D;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,IAAwB;CAAG;AA+LxE,WAAiB,IAAI;AAQrB,CAAC,EARgB,IAAI,KAAJ,IAAI,QAQpB"}
|
package/resources/index.d.ts
CHANGED
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,kCAAkC,EAClC,+BAA+B,EAC/B,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACzG,OAAO,EACL,QAAQ,EACR,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,oCAAoC,EACpC,iCAAiC,EACjC,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,EACL,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,kCAAkC,EAClC,+BAA+B,EAC/B,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACzG,OAAO,EACL,QAAQ,EACR,aAAa,EACb,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,oCAAoC,EACpC,iCAAiC,EACjC,aAAa,EACb,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,KAAK,EACL,cAAc,EACd,0BAA0B,EAC1B,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
package/resources/index.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.Moderations =
|
|
|
5
5
|
exports.Models =
|
|
6
6
|
exports.ModelsPage =
|
|
7
7
|
exports.Images =
|
|
8
|
+
exports.FineTuning =
|
|
8
9
|
exports.FineTunes =
|
|
9
10
|
exports.FineTunesPage =
|
|
10
11
|
exports.Files =
|
|
@@ -76,6 +77,13 @@ Object.defineProperty(exports, 'FineTunes', {
|
|
|
76
77
|
return fine_tunes_1.FineTunes;
|
|
77
78
|
},
|
|
78
79
|
});
|
|
80
|
+
var fine_tuning_1 = require('./fine-tuning/fine-tuning.js');
|
|
81
|
+
Object.defineProperty(exports, 'FineTuning', {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: function () {
|
|
84
|
+
return fine_tuning_1.FineTuning;
|
|
85
|
+
},
|
|
86
|
+
});
|
|
79
87
|
var images_1 = require('./images.js');
|
|
80
88
|
Object.defineProperty(exports, 'Images', {
|
|
81
89
|
enumerable: true,
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,0CAAsC;AAA7B,8FAAA,KAAK,OAAA;AACd,uCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,gDAQuB;AADrB,0GAAA,WAAW,OAAA;AAEb,8CAAqG;AAAjC,wGAAA,UAAU,OAAA;AAC9E,oCAAwD;AAAvB,8FAAA,KAAK,OAAA;AACtC,oCAAyG;AAAxC,wGAAA,eAAe,OAAA;AAAE,8FAAA,KAAK,OAAA;AACvF,8CAUsB;AAFpB,2GAAA,aAAa,OAAA;AACb,uGAAA,SAAS,OAAA;AAEX,sCAOkB;AADhB,gGAAA,MAAM,OAAA;AAER,sCAAmE;AAArC,oGAAA,UAAU,OAAA;AAAE,gGAAA,MAAM,OAAA;AAChD,gDAA0G;AAAnC,0GAAA,WAAW,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,0CAAsC;AAA7B,8FAAA,KAAK,OAAA;AACd,uCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,gDAQuB;AADrB,0GAAA,WAAW,OAAA;AAEb,8CAAqG;AAAjC,wGAAA,UAAU,OAAA;AAC9E,oCAAwD;AAAvB,8FAAA,KAAK,OAAA;AACtC,oCAAyG;AAAxC,wGAAA,eAAe,OAAA;AAAE,8FAAA,KAAK,OAAA;AACvF,8CAUsB;AAFpB,2GAAA,aAAa,OAAA;AACb,uGAAA,SAAS,OAAA;AAEX,4DAAuD;AAA9C,yGAAA,UAAU,OAAA;AACnB,sCAOkB;AADhB,gGAAA,MAAM,OAAA;AAER,sCAAmE;AAArC,oGAAA,UAAU,OAAA;AAAE,gGAAA,MAAM,OAAA;AAChD,gDAA0G;AAAnC,0GAAA,WAAW,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ export { Embeddings } from './embeddings.mjs';
|
|
|
6
6
|
export { Edits } from './edits.mjs';
|
|
7
7
|
export { FileObjectsPage, Files } from './files.mjs';
|
|
8
8
|
export { FineTunesPage, FineTunes } from './fine-tunes.mjs';
|
|
9
|
+
export { FineTuning } from './fine-tuning/fine-tuning.mjs';
|
|
9
10
|
export { Images } from './images.mjs';
|
|
10
11
|
export { ModelsPage, Models } from './models.mjs';
|
|
11
12
|
export { Moderations } from './moderations.mjs';
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAE9C,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAE;OACR,EAOL,WAAW,GACZ;OACM,EAA6D,UAAU,EAAE;OACzE,EAA0B,KAAK,EAAE;OACjC,EAA0D,eAAe,EAAE,KAAK,EAAE;OAClF,EAQL,aAAa,EACb,SAAS,GACV;OACM,EAML,MAAM,GACP;OACM,EAAuB,UAAU,EAAE,MAAM,EAAE;OAC3C,EAAgE,WAAW,EAAE"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAE9C,EAAE,KAAK,EAAE;OACT,EAAE,IAAI,EAAE;OACR,EAOL,WAAW,GACZ;OACM,EAA6D,UAAU,EAAE;OACzE,EAA0B,KAAK,EAAE;OACjC,EAA0D,eAAe,EAAE,KAAK,EAAE;OAClF,EAQL,aAAa,EACb,SAAS,GACV;OACM,EAAE,UAAU,EAAE;OACd,EAML,MAAM,GACP;OACM,EAAuB,UAAU,EAAE,MAAM,EAAE;OAC3C,EAAgE,WAAW,EAAE"}
|
package/src/_shims/fetch.d.ts
CHANGED
package/src/core.ts
CHANGED
|
@@ -803,7 +803,7 @@ declare const navigator: { userAgent: string } | undefined;
|
|
|
803
803
|
|
|
804
804
|
// Note: modified from https://github.com/JS-DevTools/host-environment/blob/b1ab79ecde37db5d6e163c050e54fe7d287d7c92/src/isomorphic.browser.ts
|
|
805
805
|
function getBrowserInfo(): BrowserInfo | null {
|
|
806
|
-
if (
|
|
806
|
+
if (typeof navigator === 'undefined' || !navigator) {
|
|
807
807
|
return null;
|
|
808
808
|
}
|
|
809
809
|
|
package/src/index.ts
CHANGED
|
@@ -143,6 +143,7 @@ export class OpenAI extends Core.APIClient {
|
|
|
143
143
|
audio: API.Audio = new API.Audio(this);
|
|
144
144
|
moderations: API.Moderations = new API.Moderations(this);
|
|
145
145
|
models: API.Models = new API.Models(this);
|
|
146
|
+
fineTuning: API.FineTuning = new API.FineTuning(this);
|
|
146
147
|
fineTunes: API.FineTunes = new API.FineTunes(this);
|
|
147
148
|
|
|
148
149
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
@@ -200,6 +201,8 @@ export namespace OpenAI {
|
|
|
200
201
|
export import toFile = Uploads.toFile;
|
|
201
202
|
export import fileFromPath = Uploads.fileFromPath;
|
|
202
203
|
|
|
204
|
+
export import RequestOptions = Core.RequestOptions;
|
|
205
|
+
|
|
203
206
|
export import Page = Pagination.Page;
|
|
204
207
|
export import PageResponse = Pagination.PageResponse;
|
|
205
208
|
|
|
@@ -248,6 +251,8 @@ export namespace OpenAI {
|
|
|
248
251
|
export import ModelDeleted = API.ModelDeleted;
|
|
249
252
|
export import ModelsPage = API.ModelsPage;
|
|
250
253
|
|
|
254
|
+
export import FineTuning = API.FineTuning;
|
|
255
|
+
|
|
251
256
|
export import FineTunes = API.FineTunes;
|
|
252
257
|
export import FineTune = API.FineTune;
|
|
253
258
|
export import FineTuneEvent = API.FineTuneEvent;
|
|
@@ -17,7 +17,7 @@ export class Completions extends APIResource {
|
|
|
17
17
|
options?: Core.RequestOptions,
|
|
18
18
|
): APIPromise<Stream<ChatCompletionChunk>>;
|
|
19
19
|
create(
|
|
20
|
-
body:
|
|
20
|
+
body: CompletionCreateParamsBase,
|
|
21
21
|
options?: Core.RequestOptions,
|
|
22
22
|
): APIPromise<Stream<ChatCompletionChunk> | ChatCompletion>;
|
|
23
23
|
create(
|
|
@@ -278,7 +278,9 @@ export namespace CreateChatCompletionRequestMessage {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
export
|
|
281
|
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
282
|
+
|
|
283
|
+
export interface CompletionCreateParamsBase {
|
|
282
284
|
/**
|
|
283
285
|
* A list of messages comprising the conversation so far.
|
|
284
286
|
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
|
|
@@ -441,7 +443,7 @@ export namespace CompletionCreateParams {
|
|
|
441
443
|
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
|
|
442
444
|
}
|
|
443
445
|
|
|
444
|
-
export interface CompletionCreateParamsNonStreaming extends
|
|
446
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
445
447
|
/**
|
|
446
448
|
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
447
449
|
* sent as data-only
|
|
@@ -453,7 +455,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
|
|
|
453
455
|
stream?: false | null;
|
|
454
456
|
}
|
|
455
457
|
|
|
456
|
-
export interface CompletionCreateParamsStreaming extends
|
|
458
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
457
459
|
/**
|
|
458
460
|
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
459
461
|
* sent as data-only
|
|
@@ -16,7 +16,7 @@ export class Completions extends APIResource {
|
|
|
16
16
|
options?: Core.RequestOptions,
|
|
17
17
|
): APIPromise<Stream<Completion>>;
|
|
18
18
|
create(
|
|
19
|
-
body:
|
|
19
|
+
body: CompletionCreateParamsBase,
|
|
20
20
|
options?: Core.RequestOptions,
|
|
21
21
|
): APIPromise<Stream<Completion> | Completion>;
|
|
22
22
|
create(
|
|
@@ -112,7 +112,9 @@ export interface CompletionUsage {
|
|
|
112
112
|
total_tokens: number;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
export
|
|
115
|
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
116
|
+
|
|
117
|
+
export interface CompletionCreateParamsBase {
|
|
116
118
|
/**
|
|
117
119
|
* ID of the model to use. You can use the
|
|
118
120
|
* [List models](/docs/api-reference/models/list) API to see all of your available
|
|
@@ -121,6 +123,8 @@ export interface CompletionCreateParams {
|
|
|
121
123
|
*/
|
|
122
124
|
model:
|
|
123
125
|
| (string & {})
|
|
126
|
+
| 'babbage-002'
|
|
127
|
+
| 'davinci-002'
|
|
124
128
|
| 'text-davinci-003'
|
|
125
129
|
| 'text-davinci-002'
|
|
126
130
|
| 'text-davinci-001'
|
|
@@ -272,7 +276,7 @@ export namespace CompletionCreateParams {
|
|
|
272
276
|
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
|
|
273
277
|
}
|
|
274
278
|
|
|
275
|
-
export interface CompletionCreateParamsNonStreaming extends
|
|
279
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
276
280
|
/**
|
|
277
281
|
* Whether to stream back partial progress. If set, tokens will be sent as
|
|
278
282
|
* data-only
|
|
@@ -284,7 +288,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
|
|
|
284
288
|
stream?: false | null;
|
|
285
289
|
}
|
|
286
290
|
|
|
287
|
-
export interface CompletionCreateParamsStreaming extends
|
|
291
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
288
292
|
/**
|
|
289
293
|
* Whether to stream back partial progress. If set, tokens will be sent as
|
|
290
294
|
* data-only
|
package/src/resources/files.ts
CHANGED
|
@@ -118,16 +118,14 @@ export interface FileCreateParams {
|
|
|
118
118
|
* Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be
|
|
119
119
|
* uploaded.
|
|
120
120
|
*
|
|
121
|
-
* If the `purpose` is set to "fine-tune",
|
|
122
|
-
* and "completion" fields representing your
|
|
123
|
-
* [training examples](/docs/guides/fine-tuning/prepare-training-data).
|
|
121
|
+
* If the `purpose` is set to "fine-tune", the file will be used for fine-tuning.
|
|
124
122
|
*/
|
|
125
123
|
file: Uploadable;
|
|
126
124
|
|
|
127
125
|
/**
|
|
128
126
|
* The intended purpose of the uploaded documents.
|
|
129
127
|
*
|
|
130
|
-
* Use "fine-tune" for [
|
|
128
|
+
* Use "fine-tune" for [fine-tuning](/docs/api-reference/fine-tuning). This allows
|
|
131
129
|
* us to validate the format of the uploaded file.
|
|
132
130
|
*/
|
|
133
131
|
purpose: string;
|
|
@@ -15,7 +15,7 @@ export class FineTunes extends APIResource {
|
|
|
15
15
|
* Response includes details of the enqueued job including job status and the name
|
|
16
16
|
* of the fine-tuned models once complete.
|
|
17
17
|
*
|
|
18
|
-
* [Learn more about
|
|
18
|
+
* [Learn more about fine-tuning](/docs/guides/legacy-fine-tuning)
|
|
19
19
|
*/
|
|
20
20
|
create(body: FineTuneCreateParams, options?: Core.RequestOptions): Core.APIPromise<FineTune> {
|
|
21
21
|
return this.post('/fine-tunes', { body, ...options });
|
|
@@ -24,7 +24,7 @@ export class FineTunes extends APIResource {
|
|
|
24
24
|
/**
|
|
25
25
|
* Gets info about the fine-tune job.
|
|
26
26
|
*
|
|
27
|
-
* [Learn more about
|
|
27
|
+
* [Learn more about fine-tuning](/docs/guides/legacy-fine-tuning)
|
|
28
28
|
*/
|
|
29
29
|
retrieve(fineTuneId: string, options?: Core.RequestOptions): Core.APIPromise<FineTune> {
|
|
30
30
|
return this.get(`/fine-tunes/${fineTuneId}`, options);
|
|
@@ -59,7 +59,7 @@ export class FineTunes extends APIResource {
|
|
|
59
59
|
): APIPromise<Stream<FineTuneEvent>>;
|
|
60
60
|
listEvents(
|
|
61
61
|
fineTuneId: string,
|
|
62
|
-
query?:
|
|
62
|
+
query?: FineTuneListEventsParamsBase | undefined,
|
|
63
63
|
options?: Core.RequestOptions,
|
|
64
64
|
): APIPromise<Stream<FineTuneEvent> | FineTuneEventsListResponse>;
|
|
65
65
|
listEvents(
|
|
@@ -84,8 +84,8 @@ export class FineTunesPage extends Page<FineTune> {}
|
|
|
84
84
|
type _FineTunesPage = FineTunesPage;
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
|
-
* The `FineTune` object represents a fine-
|
|
88
|
-
* the API.
|
|
87
|
+
* The `FineTune` object represents a legacy fine-tune job that has been created
|
|
88
|
+
* through the API.
|
|
89
89
|
*/
|
|
90
90
|
export interface FineTune {
|
|
91
91
|
/**
|
|
@@ -105,7 +105,8 @@ export interface FineTune {
|
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
107
|
* The hyperparameters used for the fine-tuning job. See the
|
|
108
|
-
* [
|
|
108
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more
|
|
109
|
+
* details.
|
|
109
110
|
*/
|
|
110
111
|
hyperparams: FineTune.Hyperparams;
|
|
111
112
|
|
|
@@ -131,7 +132,7 @@ export interface FineTune {
|
|
|
131
132
|
|
|
132
133
|
/**
|
|
133
134
|
* The current status of the fine-tuning job, which can be either `created`,
|
|
134
|
-
* `
|
|
135
|
+
* `running`, `succeeded`, `failed`, or `cancelled`.
|
|
135
136
|
*/
|
|
136
137
|
status: string;
|
|
137
138
|
|
|
@@ -159,7 +160,8 @@ export interface FineTune {
|
|
|
159
160
|
export namespace FineTune {
|
|
160
161
|
/**
|
|
161
162
|
* The hyperparameters used for the fine-tuning job. See the
|
|
162
|
-
* [
|
|
163
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more
|
|
164
|
+
* details.
|
|
163
165
|
*/
|
|
164
166
|
export interface Hyperparams {
|
|
165
167
|
/**
|
|
@@ -228,7 +230,8 @@ export interface FineTuneCreateParams {
|
|
|
228
230
|
* JSON object with the keys "prompt" and "completion". Additionally, you must
|
|
229
231
|
* upload your file with the purpose `fine-tune`.
|
|
230
232
|
*
|
|
231
|
-
* See the
|
|
233
|
+
* See the
|
|
234
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for
|
|
232
235
|
* more details.
|
|
233
236
|
*/
|
|
234
237
|
training_file: string;
|
|
@@ -273,7 +276,7 @@ export interface FineTuneCreateParams {
|
|
|
273
276
|
* If set, we calculate classification-specific metrics such as accuracy and F-1
|
|
274
277
|
* score using the validation set at the end of every epoch. These metrics can be
|
|
275
278
|
* viewed in the
|
|
276
|
-
* [results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).
|
|
279
|
+
* [results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
|
|
277
280
|
*
|
|
278
281
|
* In order to compute classification metrics, you must provide a
|
|
279
282
|
* `validation_file`. Additionally, you must specify `classification_n_classes` for
|
|
@@ -295,9 +298,9 @@ export interface FineTuneCreateParams {
|
|
|
295
298
|
|
|
296
299
|
/**
|
|
297
300
|
* The name of the base model to fine-tune. You can select one of "ada", "babbage",
|
|
298
|
-
* "curie", "davinci", or a fine-tuned model created after 2022-04-21
|
|
299
|
-
* more about these models, see the
|
|
300
|
-
*
|
|
301
|
+
* "curie", "davinci", or a fine-tuned model created after 2022-04-21 and before
|
|
302
|
+
* 2023-08-22. To learn more about these models, see the [Models](/docs/models)
|
|
303
|
+
* documentation.
|
|
301
304
|
*/
|
|
302
305
|
model?: (string & {}) | 'ada' | 'babbage' | 'curie' | 'davinci' | null;
|
|
303
306
|
|
|
@@ -332,20 +335,25 @@ export interface FineTuneCreateParams {
|
|
|
332
335
|
*
|
|
333
336
|
* If you provide this file, the data is used to generate validation metrics
|
|
334
337
|
* periodically during fine-tuning. These metrics can be viewed in the
|
|
335
|
-
* [fine-tuning results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).
|
|
338
|
+
* [fine-tuning results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
|
|
336
339
|
* Your train and validation data should be mutually exclusive.
|
|
337
340
|
*
|
|
338
341
|
* Your dataset must be formatted as a JSONL file, where each validation example is
|
|
339
342
|
* a JSON object with the keys "prompt" and "completion". Additionally, you must
|
|
340
343
|
* upload your file with the purpose `fine-tune`.
|
|
341
344
|
*
|
|
342
|
-
* See the
|
|
345
|
+
* See the
|
|
346
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for
|
|
343
347
|
* more details.
|
|
344
348
|
*/
|
|
345
349
|
validation_file?: string | null;
|
|
346
350
|
}
|
|
347
351
|
|
|
348
|
-
export
|
|
352
|
+
export type FineTuneListEventsParams =
|
|
353
|
+
| FineTuneListEventsParamsNonStreaming
|
|
354
|
+
| FineTuneListEventsParamsStreaming;
|
|
355
|
+
|
|
356
|
+
export interface FineTuneListEventsParamsBase {
|
|
349
357
|
/**
|
|
350
358
|
* Whether to stream events for the fine-tune job. If set to true, events will be
|
|
351
359
|
* sent as data-only
|
|
@@ -363,7 +371,7 @@ export namespace FineTuneListEventsParams {
|
|
|
363
371
|
export type FineTuneListEventsParamsStreaming = API.FineTuneListEventsParamsStreaming;
|
|
364
372
|
}
|
|
365
373
|
|
|
366
|
-
export interface FineTuneListEventsParamsNonStreaming extends
|
|
374
|
+
export interface FineTuneListEventsParamsNonStreaming extends FineTuneListEventsParamsBase {
|
|
367
375
|
/**
|
|
368
376
|
* Whether to stream events for the fine-tune job. If set to true, events will be
|
|
369
377
|
* sent as data-only
|
|
@@ -376,7 +384,7 @@ export interface FineTuneListEventsParamsNonStreaming extends FineTuneListEvents
|
|
|
376
384
|
stream?: false;
|
|
377
385
|
}
|
|
378
386
|
|
|
379
|
-
export interface FineTuneListEventsParamsStreaming extends
|
|
387
|
+
export interface FineTuneListEventsParamsStreaming extends FineTuneListEventsParamsBase {
|
|
380
388
|
/**
|
|
381
389
|
* Whether to stream events for the fine-tune job. If set to true, events will be
|
|
382
390
|
* sent as data-only
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import { Jobs } from './jobs';
|
|
5
|
+
import * as API from './index';
|
|
6
|
+
|
|
7
|
+
export class FineTuning extends APIResource {
|
|
8
|
+
jobs: Jobs = new Jobs(this.client);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export namespace FineTuning {
|
|
12
|
+
export import Jobs = API.Jobs;
|
|
13
|
+
export import FineTuningJob = API.FineTuningJob;
|
|
14
|
+
export import FineTuningJobEvent = API.FineTuningJobEvent;
|
|
15
|
+
export import FineTuningJobsPage = API.FineTuningJobsPage;
|
|
16
|
+
export import FineTuningJobEventsPage = API.FineTuningJobEventsPage;
|
|
17
|
+
export import JobCreateParams = API.JobCreateParams;
|
|
18
|
+
export import JobListParams = API.JobListParams;
|
|
19
|
+
export import JobListEventsParams = API.JobListEventsParams;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
export { FineTuning } from './fine-tuning';
|
|
4
|
+
export {
|
|
5
|
+
FineTuningJob,
|
|
6
|
+
FineTuningJobEvent,
|
|
7
|
+
JobCreateParams,
|
|
8
|
+
JobListParams,
|
|
9
|
+
JobListEventsParams,
|
|
10
|
+
FineTuningJobsPage,
|
|
11
|
+
FineTuningJobEventsPage,
|
|
12
|
+
Jobs,
|
|
13
|
+
} from './jobs';
|