openai 4.0.0 → 4.1.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/README.md +1 -1
- package/_shims/formdata.js +9 -1
- package/_shims/formdata.mjs +10 -1
- 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 +2 -0
- package/index.d.ts +2 -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 +8 -3
- 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 +10 -3
- 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 +29 -17
- 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 +224 -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/resources/moderations.d.ts +52 -7
- package/resources/moderations.d.ts.map +1 -1
- package/resources/moderations.js.map +1 -1
- package/resources/moderations.mjs.map +1 -1
- package/src/_shims/formdata.js +9 -1
- package/src/_shims/formdata.mjs +10 -1
- package/src/core.ts +1 -1
- package/src/index.ts +3 -0
- package/src/resources/chat/completions.ts +9 -3
- package/src/resources/completions.ts +11 -3
- package/src/resources/files.ts +2 -4
- package/src/resources/fine-tunes.ts +30 -17
- 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 +291 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/moderations.ts +60 -7
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +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;AA6LxE,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;AA6LxE,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"}
|
|
@@ -31,31 +31,60 @@ export declare namespace Moderation {
|
|
|
31
31
|
*/
|
|
32
32
|
interface Categories {
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Content that expresses, incites, or promotes harassing language towards any
|
|
35
|
+
* target.
|
|
36
|
+
*/
|
|
37
|
+
harassment: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Harassment content that also includes violence or serious harm towards any
|
|
40
|
+
* target.
|
|
41
|
+
*/
|
|
42
|
+
'harassment/threatening': boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Content that expresses, incites, or promotes hate based on race, gender,
|
|
45
|
+
* ethnicity, religion, nationality, sexual orientation, disability status, or
|
|
46
|
+
* caste. Hateful content aimed at non-protected groups (e.g., chess players) is
|
|
47
|
+
* harrassment.
|
|
35
48
|
*/
|
|
36
49
|
hate: boolean;
|
|
37
50
|
/**
|
|
38
|
-
*
|
|
51
|
+
* Hateful content that also includes violence or serious harm towards the targeted
|
|
52
|
+
* group based on race, gender, ethnicity, religion, nationality, sexual
|
|
53
|
+
* orientation, disability status, or caste.
|
|
39
54
|
*/
|
|
40
55
|
'hate/threatening': boolean;
|
|
41
56
|
/**
|
|
42
|
-
*
|
|
57
|
+
* Content that promotes, encourages, or depicts acts of self-harm, such as
|
|
58
|
+
* suicide, cutting, and eating disorders.
|
|
43
59
|
*/
|
|
44
60
|
'self-harm': boolean;
|
|
45
61
|
/**
|
|
46
|
-
*
|
|
62
|
+
* Content that encourages performing acts of self-harm, such as suicide, cutting,
|
|
63
|
+
* and eating disorders, or that gives instructions or advice on how to commit such
|
|
64
|
+
* acts.
|
|
65
|
+
*/
|
|
66
|
+
'self-harm/instructions': boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Content where the speaker expresses that they are engaging or intend to engage
|
|
69
|
+
* in acts of self-harm, such as suicide, cutting, and eating disorders.
|
|
70
|
+
*/
|
|
71
|
+
'self-harm/intent': boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Content meant to arouse sexual excitement, such as the description of sexual
|
|
74
|
+
* activity, or that promotes sexual services (excluding sex education and
|
|
75
|
+
* wellness).
|
|
47
76
|
*/
|
|
48
77
|
sexual: boolean;
|
|
49
78
|
/**
|
|
50
|
-
*
|
|
79
|
+
* Sexual content that includes an individual who is under 18 years old.
|
|
51
80
|
*/
|
|
52
81
|
'sexual/minors': boolean;
|
|
53
82
|
/**
|
|
54
|
-
*
|
|
83
|
+
* Content that depicts death, violence, or physical injury.
|
|
55
84
|
*/
|
|
56
85
|
violence: boolean;
|
|
57
86
|
/**
|
|
58
|
-
*
|
|
87
|
+
* Content that depicts death, violence, or physical injury in graphic detail.
|
|
59
88
|
*/
|
|
60
89
|
'violence/graphic': boolean;
|
|
61
90
|
}
|
|
@@ -63,6 +92,14 @@ export declare namespace Moderation {
|
|
|
63
92
|
* A list of the categories along with their scores as predicted by model.
|
|
64
93
|
*/
|
|
65
94
|
interface CategoryScores {
|
|
95
|
+
/**
|
|
96
|
+
* The score for the category 'harassment'.
|
|
97
|
+
*/
|
|
98
|
+
harassment: number;
|
|
99
|
+
/**
|
|
100
|
+
* The score for the category 'harassment/threatening'.
|
|
101
|
+
*/
|
|
102
|
+
'harassment/threatening': number;
|
|
66
103
|
/**
|
|
67
104
|
* The score for the category 'hate'.
|
|
68
105
|
*/
|
|
@@ -75,6 +112,14 @@ export declare namespace Moderation {
|
|
|
75
112
|
* The score for the category 'self-harm'.
|
|
76
113
|
*/
|
|
77
114
|
'self-harm': number;
|
|
115
|
+
/**
|
|
116
|
+
* The score for the category 'self-harm/instructions'.
|
|
117
|
+
*/
|
|
118
|
+
'self-harm/instructions': number;
|
|
119
|
+
/**
|
|
120
|
+
* The score for the category 'self-harm/intent'.
|
|
121
|
+
*/
|
|
122
|
+
'self-harm/intent': number;
|
|
78
123
|
/**
|
|
79
124
|
* The score for the category 'sexual'.
|
|
80
125
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderations.d.ts","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,wBAAwB,CAAC;CAG7C;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC;IAElC;;OAEG;IACH,eAAe,EAAE,UAAU,CAAC,cAAc,CAAC;IAE3C;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,yBAAiB,UAAU,CAAC;IAC1B;;OAEG;IACH,UAAiB,UAAU;QACzB
|
|
1
|
+
{"version":3,"file":"moderations.d.ts","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAE/B,qBAAa,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,wBAAwB,CAAC;CAG7C;AAED,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC;IAElC;;OAEG;IACH,eAAe,EAAE,UAAU,CAAC,cAAc,CAAC;IAE3C;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,yBAAiB,UAAU,CAAC;IAC1B;;OAEG;IACH,UAAiB,UAAU;QACzB;;;WAGG;QACH,UAAU,EAAE,OAAO,CAAC;QAEpB;;;WAGG;QACH,wBAAwB,EAAE,OAAO,CAAC;QAElC;;;;;WAKG;QACH,IAAI,EAAE,OAAO,CAAC;QAEd;;;;WAIG;QACH,kBAAkB,EAAE,OAAO,CAAC;QAE5B;;;WAGG;QACH,WAAW,EAAE,OAAO,CAAC;QAErB;;;;WAIG;QACH,wBAAwB,EAAE,OAAO,CAAC;QAElC;;;WAGG;QACH,kBAAkB,EAAE,OAAO,CAAC;QAE5B;;;;WAIG;QACH,MAAM,EAAE,OAAO,CAAC;QAEhB;;WAEG;QACH,eAAe,EAAE,OAAO,CAAC;QAEzB;;WAEG;QACH,QAAQ,EAAE,OAAO,CAAC;QAElB;;WAEG;QACH,kBAAkB,EAAE,OAAO,CAAC;KAC7B;IAED;;OAEG;IACH,UAAiB,cAAc;QAC7B;;WAEG;QACH,UAAU,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,wBAAwB,EAAE,MAAM,CAAC;QAEjC;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,kBAAkB,EAAE,MAAM,CAAC;QAE3B;;WAEG;QACH,WAAW,EAAE,MAAM,CAAC;QAEpB;;WAEG;QACH,wBAAwB,EAAE,MAAM,CAAC;QAEjC;;WAEG;QACH,kBAAkB,EAAE,MAAM,CAAC;QAE3B;;WAEG;QACH,MAAM,EAAE,MAAM,CAAC;QAEf;;WAEG;QACH,eAAe,EAAE,MAAM,CAAC;QAExB;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,kBAAkB,EAAE,MAAM,CAAC;KAC5B;CACF;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAE9B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,wBAAwB,GAAG,wBAAwB,CAAC;CAC7E;AAED,yBAAiB,WAAW,CAAC;IAC3B,MAAM,QAAQ,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IAC1C,MAAM,QAAQ,wBAAwB,GAAG,GAAG,CAAC,wBAAwB,CAAC;IACtE,MAAM,QAAQ,sBAAsB,GAAG,GAAG,CAAC,sBAAsB,CAAC;CACnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderations.js","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;AAG9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;CACF;AAVD,kCAUC;
|
|
1
|
+
{"version":3,"file":"moderations.js","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,8CAA8C;AAG9C,MAAa,WAAY,SAAQ,sBAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;CACF;AAVD,kCAUC;AAmMD,WAAiB,WAAW;AAI5B,CAAC,EAJgB,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAI3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moderations.mjs","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;AAG7C,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"moderations.mjs","sourceRoot":"","sources":["../src/resources/moderations.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,iBAAiB;AAG7C,MAAM,OAAO,WAAY,SAAQ,WAAW;IAC1C;;OAEG;IACH,MAAM,CACJ,IAA4B,EAC5B,OAA6B;QAE7B,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;CACF;AAmMD,WAAiB,WAAW;AAI5B,CAAC,EAJgB,WAAW,KAAX,WAAW,QAI3B"}
|
package/src/_shims/formdata.js
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
exports.FormData = FormData;
|
|
6
|
-
exports.File = File;
|
|
7
6
|
exports.Blob = Blob;
|
|
7
|
+
exports.File =
|
|
8
|
+
typeof File !== 'undefined' ? File : (
|
|
9
|
+
// Bun doesn't implement File yet, so just make a shim that throws a helpful error message
|
|
10
|
+
class File extends Blob {
|
|
11
|
+
constructor() {
|
|
12
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'File' is not defined`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
);
|
|
8
16
|
|
|
9
17
|
exports.isPolyfilled = false;
|
package/src/_shims/formdata.mjs
CHANGED
|
@@ -3,9 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
const _FormData = FormData;
|
|
6
|
-
const _File = File;
|
|
7
6
|
const _Blob = Blob;
|
|
8
7
|
|
|
8
|
+
const _File =
|
|
9
|
+
typeof File !== 'undefined' ? File : (
|
|
10
|
+
// Bun doesn't implement File yet, so just make a shim that throws a helpful error message
|
|
11
|
+
class File extends Blob {
|
|
12
|
+
constructor() {
|
|
13
|
+
throw new Error(`file uploads aren't supported in this environment yet as 'File' is not defined`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
9
18
|
export { _FormData as FormData, _File as File, _Blob as Blob };
|
|
10
19
|
|
|
11
20
|
export const isPolyfilled = false;
|
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 {
|
|
@@ -248,6 +249,8 @@ export namespace OpenAI {
|
|
|
248
249
|
export import ModelDeleted = API.ModelDeleted;
|
|
249
250
|
export import ModelsPage = API.ModelsPage;
|
|
250
251
|
|
|
252
|
+
export import FineTuning = API.FineTuning;
|
|
253
|
+
|
|
251
254
|
export import FineTunes = API.FineTunes;
|
|
252
255
|
export import FineTune = API.FineTune;
|
|
253
256
|
export import FineTuneEvent = API.FineTuneEvent;
|
|
@@ -16,6 +16,10 @@ export class Completions extends APIResource {
|
|
|
16
16
|
body: CompletionCreateParamsStreaming,
|
|
17
17
|
options?: Core.RequestOptions,
|
|
18
18
|
): APIPromise<Stream<ChatCompletionChunk>>;
|
|
19
|
+
create(
|
|
20
|
+
body: CompletionCreateParamsBase,
|
|
21
|
+
options?: Core.RequestOptions,
|
|
22
|
+
): APIPromise<Stream<ChatCompletionChunk> | ChatCompletion>;
|
|
19
23
|
create(
|
|
20
24
|
body: CompletionCreateParams,
|
|
21
25
|
options?: Core.RequestOptions,
|
|
@@ -274,7 +278,9 @@ export namespace CreateChatCompletionRequestMessage {
|
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
280
|
|
|
277
|
-
export
|
|
281
|
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
282
|
+
|
|
283
|
+
export interface CompletionCreateParamsBase {
|
|
278
284
|
/**
|
|
279
285
|
* A list of messages comprising the conversation so far.
|
|
280
286
|
* [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb).
|
|
@@ -437,7 +443,7 @@ export namespace CompletionCreateParams {
|
|
|
437
443
|
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
|
|
438
444
|
}
|
|
439
445
|
|
|
440
|
-
export interface CompletionCreateParamsNonStreaming extends
|
|
446
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
441
447
|
/**
|
|
442
448
|
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
443
449
|
* sent as data-only
|
|
@@ -449,7 +455,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
|
|
|
449
455
|
stream?: false | null;
|
|
450
456
|
}
|
|
451
457
|
|
|
452
|
-
export interface CompletionCreateParamsStreaming extends
|
|
458
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
453
459
|
/**
|
|
454
460
|
* If set, partial message deltas will be sent, like in ChatGPT. Tokens will be
|
|
455
461
|
* sent as data-only
|
|
@@ -15,6 +15,10 @@ export class Completions extends APIResource {
|
|
|
15
15
|
body: CompletionCreateParamsStreaming,
|
|
16
16
|
options?: Core.RequestOptions,
|
|
17
17
|
): APIPromise<Stream<Completion>>;
|
|
18
|
+
create(
|
|
19
|
+
body: CompletionCreateParamsBase,
|
|
20
|
+
options?: Core.RequestOptions,
|
|
21
|
+
): APIPromise<Stream<Completion> | Completion>;
|
|
18
22
|
create(
|
|
19
23
|
body: CompletionCreateParams,
|
|
20
24
|
options?: Core.RequestOptions,
|
|
@@ -108,7 +112,9 @@ export interface CompletionUsage {
|
|
|
108
112
|
total_tokens: number;
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
export
|
|
115
|
+
export type CompletionCreateParams = CompletionCreateParamsNonStreaming | CompletionCreateParamsStreaming;
|
|
116
|
+
|
|
117
|
+
export interface CompletionCreateParamsBase {
|
|
112
118
|
/**
|
|
113
119
|
* ID of the model to use. You can use the
|
|
114
120
|
* [List models](/docs/api-reference/models/list) API to see all of your available
|
|
@@ -117,6 +123,8 @@ export interface CompletionCreateParams {
|
|
|
117
123
|
*/
|
|
118
124
|
model:
|
|
119
125
|
| (string & {})
|
|
126
|
+
| 'babbage-002'
|
|
127
|
+
| 'davinci-002'
|
|
120
128
|
| 'text-davinci-003'
|
|
121
129
|
| 'text-davinci-002'
|
|
122
130
|
| 'text-davinci-001'
|
|
@@ -268,7 +276,7 @@ export namespace CompletionCreateParams {
|
|
|
268
276
|
export type CompletionCreateParamsStreaming = API.CompletionCreateParamsStreaming;
|
|
269
277
|
}
|
|
270
278
|
|
|
271
|
-
export interface CompletionCreateParamsNonStreaming extends
|
|
279
|
+
export interface CompletionCreateParamsNonStreaming extends CompletionCreateParamsBase {
|
|
272
280
|
/**
|
|
273
281
|
* Whether to stream back partial progress. If set, tokens will be sent as
|
|
274
282
|
* data-only
|
|
@@ -280,7 +288,7 @@ export interface CompletionCreateParamsNonStreaming extends CompletionCreatePara
|
|
|
280
288
|
stream?: false | null;
|
|
281
289
|
}
|
|
282
290
|
|
|
283
|
-
export interface CompletionCreateParamsStreaming extends
|
|
291
|
+
export interface CompletionCreateParamsStreaming extends CompletionCreateParamsBase {
|
|
284
292
|
/**
|
|
285
293
|
* Whether to stream back partial progress. If set, tokens will be sent as
|
|
286
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);
|
|
@@ -57,6 +57,11 @@ export class FineTunes extends APIResource {
|
|
|
57
57
|
query: FineTuneListEventsParamsStreaming,
|
|
58
58
|
options?: Core.RequestOptions,
|
|
59
59
|
): APIPromise<Stream<FineTuneEvent>>;
|
|
60
|
+
listEvents(
|
|
61
|
+
fineTuneId: string,
|
|
62
|
+
query?: FineTuneListEventsParamsBase | undefined,
|
|
63
|
+
options?: Core.RequestOptions,
|
|
64
|
+
): APIPromise<Stream<FineTuneEvent> | FineTuneEventsListResponse>;
|
|
60
65
|
listEvents(
|
|
61
66
|
fineTuneId: string,
|
|
62
67
|
query?: FineTuneListEventsParams | undefined,
|
|
@@ -79,8 +84,8 @@ export class FineTunesPage extends Page<FineTune> {}
|
|
|
79
84
|
type _FineTunesPage = FineTunesPage;
|
|
80
85
|
|
|
81
86
|
/**
|
|
82
|
-
* The `FineTune` object represents a fine-
|
|
83
|
-
* the API.
|
|
87
|
+
* The `FineTune` object represents a legacy fine-tune job that has been created
|
|
88
|
+
* through the API.
|
|
84
89
|
*/
|
|
85
90
|
export interface FineTune {
|
|
86
91
|
/**
|
|
@@ -100,7 +105,8 @@ export interface FineTune {
|
|
|
100
105
|
|
|
101
106
|
/**
|
|
102
107
|
* The hyperparameters used for the fine-tuning job. See the
|
|
103
|
-
* [
|
|
108
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more
|
|
109
|
+
* details.
|
|
104
110
|
*/
|
|
105
111
|
hyperparams: FineTune.Hyperparams;
|
|
106
112
|
|
|
@@ -126,7 +132,7 @@ export interface FineTune {
|
|
|
126
132
|
|
|
127
133
|
/**
|
|
128
134
|
* The current status of the fine-tuning job, which can be either `created`,
|
|
129
|
-
* `
|
|
135
|
+
* `running`, `succeeded`, `failed`, or `cancelled`.
|
|
130
136
|
*/
|
|
131
137
|
status: string;
|
|
132
138
|
|
|
@@ -154,7 +160,8 @@ export interface FineTune {
|
|
|
154
160
|
export namespace FineTune {
|
|
155
161
|
/**
|
|
156
162
|
* The hyperparameters used for the fine-tuning job. See the
|
|
157
|
-
* [
|
|
163
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more
|
|
164
|
+
* details.
|
|
158
165
|
*/
|
|
159
166
|
export interface Hyperparams {
|
|
160
167
|
/**
|
|
@@ -223,7 +230,8 @@ export interface FineTuneCreateParams {
|
|
|
223
230
|
* JSON object with the keys "prompt" and "completion". Additionally, you must
|
|
224
231
|
* upload your file with the purpose `fine-tune`.
|
|
225
232
|
*
|
|
226
|
-
* See the
|
|
233
|
+
* See the
|
|
234
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for
|
|
227
235
|
* more details.
|
|
228
236
|
*/
|
|
229
237
|
training_file: string;
|
|
@@ -268,7 +276,7 @@ export interface FineTuneCreateParams {
|
|
|
268
276
|
* If set, we calculate classification-specific metrics such as accuracy and F-1
|
|
269
277
|
* score using the validation set at the end of every epoch. These metrics can be
|
|
270
278
|
* viewed in the
|
|
271
|
-
* [results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model).
|
|
279
|
+
* [results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model).
|
|
272
280
|
*
|
|
273
281
|
* In order to compute classification metrics, you must provide a
|
|
274
282
|
* `validation_file`. Additionally, you must specify `classification_n_classes` for
|
|
@@ -290,9 +298,9 @@ export interface FineTuneCreateParams {
|
|
|
290
298
|
|
|
291
299
|
/**
|
|
292
300
|
* The name of the base model to fine-tune. You can select one of "ada", "babbage",
|
|
293
|
-
* "curie", "davinci", or a fine-tuned model created after 2022-04-21
|
|
294
|
-
* more about these models, see the
|
|
295
|
-
*
|
|
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.
|
|
296
304
|
*/
|
|
297
305
|
model?: (string & {}) | 'ada' | 'babbage' | 'curie' | 'davinci' | null;
|
|
298
306
|
|
|
@@ -327,20 +335,25 @@ export interface FineTuneCreateParams {
|
|
|
327
335
|
*
|
|
328
336
|
* If you provide this file, the data is used to generate validation metrics
|
|
329
337
|
* periodically during fine-tuning. These metrics can be viewed in the
|
|
330
|
-
* [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).
|
|
331
339
|
* Your train and validation data should be mutually exclusive.
|
|
332
340
|
*
|
|
333
341
|
* Your dataset must be formatted as a JSONL file, where each validation example is
|
|
334
342
|
* a JSON object with the keys "prompt" and "completion". Additionally, you must
|
|
335
343
|
* upload your file with the purpose `fine-tune`.
|
|
336
344
|
*
|
|
337
|
-
* See the
|
|
345
|
+
* See the
|
|
346
|
+
* [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for
|
|
338
347
|
* more details.
|
|
339
348
|
*/
|
|
340
349
|
validation_file?: string | null;
|
|
341
350
|
}
|
|
342
351
|
|
|
343
|
-
export
|
|
352
|
+
export type FineTuneListEventsParams =
|
|
353
|
+
| FineTuneListEventsParamsNonStreaming
|
|
354
|
+
| FineTuneListEventsParamsStreaming;
|
|
355
|
+
|
|
356
|
+
export interface FineTuneListEventsParamsBase {
|
|
344
357
|
/**
|
|
345
358
|
* Whether to stream events for the fine-tune job. If set to true, events will be
|
|
346
359
|
* sent as data-only
|
|
@@ -358,7 +371,7 @@ export namespace FineTuneListEventsParams {
|
|
|
358
371
|
export type FineTuneListEventsParamsStreaming = API.FineTuneListEventsParamsStreaming;
|
|
359
372
|
}
|
|
360
373
|
|
|
361
|
-
export interface FineTuneListEventsParamsNonStreaming extends
|
|
374
|
+
export interface FineTuneListEventsParamsNonStreaming extends FineTuneListEventsParamsBase {
|
|
362
375
|
/**
|
|
363
376
|
* Whether to stream events for the fine-tune job. If set to true, events will be
|
|
364
377
|
* sent as data-only
|
|
@@ -371,7 +384,7 @@ export interface FineTuneListEventsParamsNonStreaming extends FineTuneListEvents
|
|
|
371
384
|
stream?: false;
|
|
372
385
|
}
|
|
373
386
|
|
|
374
|
-
export interface FineTuneListEventsParamsStreaming extends
|
|
387
|
+
export interface FineTuneListEventsParamsStreaming extends FineTuneListEventsParamsBase {
|
|
375
388
|
/**
|
|
376
389
|
* Whether to stream events for the fine-tune job. If set to true, events will be
|
|
377
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
|
+
}
|