openai 4.52.6 → 4.53.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 +23 -0
- package/README.md +21 -9
- package/index.d.mts +5 -0
- package/index.d.ts +5 -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/beta/assistants.d.ts +1 -1
- package/resources/beta/assistants.d.ts.map +1 -1
- package/resources/beta/assistants.js.map +1 -1
- package/resources/beta/assistants.mjs.map +1 -1
- package/resources/beta/threads/runs/runs.d.ts +1 -1
- package/resources/beta/threads/runs/runs.d.ts.map +1 -1
- package/resources/beta/threads/runs/runs.js.map +1 -1
- package/resources/beta/threads/runs/runs.mjs.map +1 -1
- package/resources/beta/threads/threads.d.ts +1 -1
- package/resources/beta/threads/threads.d.ts.map +1 -1
- package/resources/beta/threads/threads.js.map +1 -1
- package/resources/beta/threads/threads.mjs.map +1 -1
- package/resources/chat/chat.d.ts +1 -1
- package/resources/chat/chat.d.ts.map +1 -1
- package/resources/chat/chat.js.map +1 -1
- package/resources/chat/chat.mjs.map +1 -1
- package/resources/chat/completions.d.ts +1 -0
- 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/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/uploads/index.d.ts +3 -0
- package/resources/uploads/index.d.ts.map +1 -0
- package/resources/uploads/index.js +9 -0
- package/resources/uploads/index.js.map +1 -0
- package/resources/uploads/index.mjs +4 -0
- package/resources/uploads/index.mjs.map +1 -0
- package/resources/uploads/parts.d.ts +51 -0
- package/resources/uploads/parts.d.ts.map +1 -0
- package/resources/uploads/parts.js +51 -0
- package/resources/uploads/parts.js.map +1 -0
- package/resources/uploads/parts.mjs +24 -0
- package/resources/uploads/parts.mjs.map +1 -0
- package/resources/uploads/uploads.d.ts +138 -0
- package/resources/uploads/uploads.d.ts.map +1 -0
- package/resources/uploads/uploads.js +89 -0
- package/resources/uploads/uploads.js.map +1 -0
- package/resources/uploads/uploads.mjs +62 -0
- package/resources/uploads/uploads.mjs.map +1 -0
- package/src/index.ts +6 -0
- package/src/resources/beta/assistants.ts +2 -0
- package/src/resources/beta/threads/runs/runs.ts +2 -0
- package/src/resources/beta/threads/threads.ts +2 -0
- package/src/resources/chat/chat.ts +2 -0
- package/src/resources/chat/completions.ts +1 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/uploads/index.ts +4 -0
- package/src/resources/uploads/parts.ts +68 -0
- package/src/resources/uploads/uploads.ts +169 -0
- 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,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Uploads = void 0;
|
|
28
|
+
const resource_1 = require("../../resource.js");
|
|
29
|
+
const PartsAPI = __importStar(require("./parts.js"));
|
|
30
|
+
class Uploads extends resource_1.APIResource {
|
|
31
|
+
constructor() {
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.parts = new PartsAPI.Parts(this._client);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates an intermediate
|
|
37
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
|
|
38
|
+
* that you can add
|
|
39
|
+
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
|
|
40
|
+
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
|
|
41
|
+
* after you create it.
|
|
42
|
+
*
|
|
43
|
+
* Once you complete the Upload, we will create a
|
|
44
|
+
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
|
|
45
|
+
* contains all the parts you uploaded. This File is usable in the rest of our
|
|
46
|
+
* platform as a regular File object.
|
|
47
|
+
*
|
|
48
|
+
* For certain `purpose`s, the correct `mime_type` must be specified. Please refer
|
|
49
|
+
* to documentation for the supported MIME types for your use case:
|
|
50
|
+
*
|
|
51
|
+
* - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search/supported-files)
|
|
52
|
+
*
|
|
53
|
+
* For guidance on the proper filename extensions for each purpose, please follow
|
|
54
|
+
* the documentation on
|
|
55
|
+
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
|
|
56
|
+
*/
|
|
57
|
+
create(body, options) {
|
|
58
|
+
return this._client.post('/uploads', { body, ...options });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
62
|
+
*/
|
|
63
|
+
cancel(uploadId, options) {
|
|
64
|
+
return this._client.post(`/uploads/${uploadId}/cancel`, options);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Completes the
|
|
68
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
|
|
69
|
+
*
|
|
70
|
+
* Within the returned Upload object, there is a nested
|
|
71
|
+
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
|
|
72
|
+
* is ready to use in the rest of the platform.
|
|
73
|
+
*
|
|
74
|
+
* You can specify the order of the Parts by passing in an ordered list of the Part
|
|
75
|
+
* IDs.
|
|
76
|
+
*
|
|
77
|
+
* The number of bytes uploaded upon completion must match the number of bytes
|
|
78
|
+
* initially specified when creating the Upload object. No Parts may be added after
|
|
79
|
+
* an Upload is completed.
|
|
80
|
+
*/
|
|
81
|
+
complete(uploadId, body, options) {
|
|
82
|
+
return this._client.post(`/uploads/${uploadId}/complete`, { body, ...options });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.Uploads = Uploads;
|
|
86
|
+
(function (Uploads) {
|
|
87
|
+
Uploads.Parts = PartsAPI.Parts;
|
|
88
|
+
})(Uploads = exports.Uploads || (exports.Uploads = {}));
|
|
89
|
+
//# sourceMappingURL=uploads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.js","sourceRoot":"","sources":["../../src/resources/uploads/uploads.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAI7C,qDAAoC;AAEpC,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAyD3D,CAAC;IAvDC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAgB,EAAE,OAA6B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,QAAQ,SAAS,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CACN,QAAgB,EAChB,IAA0B,EAC1B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,QAAQ,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AA1DD,0BA0DC;AA+FD,WAAiB,OAAO;IAIR,aAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;AAGvC,CAAC,EAPgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAOvB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../resource.mjs";
|
|
3
|
+
import * as PartsAPI from "./parts.mjs";
|
|
4
|
+
export class Uploads extends APIResource {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.parts = new PartsAPI.Parts(this._client);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates an intermediate
|
|
11
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
|
|
12
|
+
* that you can add
|
|
13
|
+
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
|
|
14
|
+
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
|
|
15
|
+
* after you create it.
|
|
16
|
+
*
|
|
17
|
+
* Once you complete the Upload, we will create a
|
|
18
|
+
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
|
|
19
|
+
* contains all the parts you uploaded. This File is usable in the rest of our
|
|
20
|
+
* platform as a regular File object.
|
|
21
|
+
*
|
|
22
|
+
* For certain `purpose`s, the correct `mime_type` must be specified. Please refer
|
|
23
|
+
* to documentation for the supported MIME types for your use case:
|
|
24
|
+
*
|
|
25
|
+
* - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search/supported-files)
|
|
26
|
+
*
|
|
27
|
+
* For guidance on the proper filename extensions for each purpose, please follow
|
|
28
|
+
* the documentation on
|
|
29
|
+
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
|
|
30
|
+
*/
|
|
31
|
+
create(body, options) {
|
|
32
|
+
return this._client.post('/uploads', { body, ...options });
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
36
|
+
*/
|
|
37
|
+
cancel(uploadId, options) {
|
|
38
|
+
return this._client.post(`/uploads/${uploadId}/cancel`, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Completes the
|
|
42
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
|
|
43
|
+
*
|
|
44
|
+
* Within the returned Upload object, there is a nested
|
|
45
|
+
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
|
|
46
|
+
* is ready to use in the rest of the platform.
|
|
47
|
+
*
|
|
48
|
+
* You can specify the order of the Parts by passing in an ordered list of the Part
|
|
49
|
+
* IDs.
|
|
50
|
+
*
|
|
51
|
+
* The number of bytes uploaded upon completion must match the number of bytes
|
|
52
|
+
* initially specified when creating the Upload object. No Parts may be added after
|
|
53
|
+
* an Upload is completed.
|
|
54
|
+
*/
|
|
55
|
+
complete(uploadId, body, options) {
|
|
56
|
+
return this._client.post(`/uploads/${uploadId}/complete`, { body, ...options });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
(function (Uploads) {
|
|
60
|
+
Uploads.Parts = PartsAPI.Parts;
|
|
61
|
+
})(Uploads || (Uploads = {}));
|
|
62
|
+
//# sourceMappingURL=uploads.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploads.mjs","sourceRoot":"","sources":["../../src/resources/uploads/uploads.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,KAAK,QAAQ;AAEpB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,UAAK,GAAmB,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAyD3D,CAAC;IAvDC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAgB,EAAE,OAA6B;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,QAAQ,SAAS,EAAE,OAAO,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CACN,QAAgB,EAChB,IAA0B,EAC1B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,QAAQ,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;CACF;AA+FD,WAAiB,OAAO;IAIR,aAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;AAGvC,CAAC,EAPgB,OAAO,KAAP,OAAO,QAOvB"}
|
package/src/index.ts
CHANGED
|
@@ -164,6 +164,7 @@ export class OpenAI extends Core.APIClient {
|
|
|
164
164
|
fineTuning: API.FineTuning = new API.FineTuning(this);
|
|
165
165
|
beta: API.Beta = new API.Beta(this);
|
|
166
166
|
batches: API.Batches = new API.Batches(this);
|
|
167
|
+
uploads: API.Uploads = new API.Uploads(this);
|
|
167
168
|
|
|
168
169
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
169
170
|
return this._options.defaultQuery;
|
|
@@ -309,6 +310,11 @@ export namespace OpenAI {
|
|
|
309
310
|
export import BatchCreateParams = API.BatchCreateParams;
|
|
310
311
|
export import BatchListParams = API.BatchListParams;
|
|
311
312
|
|
|
313
|
+
export import Uploads = API.Uploads;
|
|
314
|
+
export import Upload = API.Upload;
|
|
315
|
+
export import UploadCreateParams = API.UploadCreateParams;
|
|
316
|
+
export import UploadCompleteParams = API.UploadCompleteParams;
|
|
317
|
+
|
|
312
318
|
export import ErrorObject = API.ErrorObject;
|
|
313
319
|
export import FunctionDefinition = API.FunctionDefinition;
|
|
314
320
|
export import FunctionParameters = API.FunctionParameters;
|
|
@@ -820,6 +820,7 @@ export interface ChatCompletionCreateParamsBase {
|
|
|
820
820
|
* exhausted.
|
|
821
821
|
* - If set to 'default', the request will be processed using the default service
|
|
822
822
|
* tier with a lower uptime SLA and no latency guarentee.
|
|
823
|
+
* - When not set, the default behavior is 'auto'.
|
|
823
824
|
*
|
|
824
825
|
* When this parameter is set, the response body will include the `service_tier`
|
|
825
826
|
* utilized.
|
package/src/resources/index.ts
CHANGED
|
@@ -43,3 +43,4 @@ export {
|
|
|
43
43
|
} from './images';
|
|
44
44
|
export { Model, ModelDeleted, ModelsPage, Models } from './models';
|
|
45
45
|
export { Moderation, ModerationCreateResponse, ModerationCreateParams, Moderations } from './moderations';
|
|
46
|
+
export { Upload, UploadCreateParams, UploadCompleteParams, Uploads } from './uploads/uploads';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import * as Core from '../../core';
|
|
5
|
+
import * as PartsAPI from './parts';
|
|
6
|
+
|
|
7
|
+
export class Parts extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Adds a
|
|
10
|
+
* [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an
|
|
11
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object.
|
|
12
|
+
* A Part represents a chunk of bytes from the file you are trying to upload.
|
|
13
|
+
*
|
|
14
|
+
* Each Part can be at most 64 MB, and you can add Parts until you hit the Upload
|
|
15
|
+
* maximum of 8 GB.
|
|
16
|
+
*
|
|
17
|
+
* It is possible to add multiple Parts in parallel. You can decide the intended
|
|
18
|
+
* order of the Parts when you
|
|
19
|
+
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
20
|
+
*/
|
|
21
|
+
create(
|
|
22
|
+
uploadId: string,
|
|
23
|
+
body: PartCreateParams,
|
|
24
|
+
options?: Core.RequestOptions,
|
|
25
|
+
): Core.APIPromise<UploadPart> {
|
|
26
|
+
return this._client.post(
|
|
27
|
+
`/uploads/${uploadId}/parts`,
|
|
28
|
+
Core.multipartFormRequestOptions({ body, ...options }),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The upload Part represents a chunk of bytes we can add to an Upload object.
|
|
35
|
+
*/
|
|
36
|
+
export interface UploadPart {
|
|
37
|
+
/**
|
|
38
|
+
* The upload Part unique identifier, which can be referenced in API endpoints.
|
|
39
|
+
*/
|
|
40
|
+
id: string;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The Unix timestamp (in seconds) for when the Part was created.
|
|
44
|
+
*/
|
|
45
|
+
created_at: number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The object type, which is always `upload.part`.
|
|
49
|
+
*/
|
|
50
|
+
object: 'upload.part';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The ID of the Upload object that this Part was added to.
|
|
54
|
+
*/
|
|
55
|
+
upload_id: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface PartCreateParams {
|
|
59
|
+
/**
|
|
60
|
+
* The chunk of bytes for this Part.
|
|
61
|
+
*/
|
|
62
|
+
data: Core.Uploadable;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export namespace Parts {
|
|
66
|
+
export import UploadPart = PartsAPI.UploadPart;
|
|
67
|
+
export import PartCreateParams = PartsAPI.PartCreateParams;
|
|
68
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import * as Core from '../../core';
|
|
5
|
+
import * as UploadsAPI from './uploads';
|
|
6
|
+
import * as FilesAPI from '../files';
|
|
7
|
+
import * as PartsAPI from './parts';
|
|
8
|
+
|
|
9
|
+
export class Uploads extends APIResource {
|
|
10
|
+
parts: PartsAPI.Parts = new PartsAPI.Parts(this._client);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates an intermediate
|
|
14
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object
|
|
15
|
+
* that you can add
|
|
16
|
+
* [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to.
|
|
17
|
+
* Currently, an Upload can accept at most 8 GB in total and expires after an hour
|
|
18
|
+
* after you create it.
|
|
19
|
+
*
|
|
20
|
+
* Once you complete the Upload, we will create a
|
|
21
|
+
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
|
|
22
|
+
* contains all the parts you uploaded. This File is usable in the rest of our
|
|
23
|
+
* platform as a regular File object.
|
|
24
|
+
*
|
|
25
|
+
* For certain `purpose`s, the correct `mime_type` must be specified. Please refer
|
|
26
|
+
* to documentation for the supported MIME types for your use case:
|
|
27
|
+
*
|
|
28
|
+
* - [Assistants](https://platform.openai.com/docs/assistants/tools/file-search/supported-files)
|
|
29
|
+
*
|
|
30
|
+
* For guidance on the proper filename extensions for each purpose, please follow
|
|
31
|
+
* the documentation on
|
|
32
|
+
* [creating a File](https://platform.openai.com/docs/api-reference/files/create).
|
|
33
|
+
*/
|
|
34
|
+
create(body: UploadCreateParams, options?: Core.RequestOptions): Core.APIPromise<Upload> {
|
|
35
|
+
return this._client.post('/uploads', { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
40
|
+
*/
|
|
41
|
+
cancel(uploadId: string, options?: Core.RequestOptions): Core.APIPromise<Upload> {
|
|
42
|
+
return this._client.post(`/uploads/${uploadId}/cancel`, options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Completes the
|
|
47
|
+
* [Upload](https://platform.openai.com/docs/api-reference/uploads/object).
|
|
48
|
+
*
|
|
49
|
+
* Within the returned Upload object, there is a nested
|
|
50
|
+
* [File](https://platform.openai.com/docs/api-reference/files/object) object that
|
|
51
|
+
* is ready to use in the rest of the platform.
|
|
52
|
+
*
|
|
53
|
+
* You can specify the order of the Parts by passing in an ordered list of the Part
|
|
54
|
+
* IDs.
|
|
55
|
+
*
|
|
56
|
+
* The number of bytes uploaded upon completion must match the number of bytes
|
|
57
|
+
* initially specified when creating the Upload object. No Parts may be added after
|
|
58
|
+
* an Upload is completed.
|
|
59
|
+
*/
|
|
60
|
+
complete(
|
|
61
|
+
uploadId: string,
|
|
62
|
+
body: UploadCompleteParams,
|
|
63
|
+
options?: Core.RequestOptions,
|
|
64
|
+
): Core.APIPromise<Upload> {
|
|
65
|
+
return this._client.post(`/uploads/${uploadId}/complete`, { body, ...options });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The Upload object can accept byte chunks in the form of Parts.
|
|
71
|
+
*/
|
|
72
|
+
export interface Upload {
|
|
73
|
+
/**
|
|
74
|
+
* The Upload unique identifier, which can be referenced in API endpoints.
|
|
75
|
+
*/
|
|
76
|
+
id: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The intended number of bytes to be uploaded.
|
|
80
|
+
*/
|
|
81
|
+
bytes: number;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The Unix timestamp (in seconds) for when the Upload was created.
|
|
85
|
+
*/
|
|
86
|
+
created_at: number;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The Unix timestamp (in seconds) for when the Upload was created.
|
|
90
|
+
*/
|
|
91
|
+
expires_at: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The name of the file to be uploaded.
|
|
95
|
+
*/
|
|
96
|
+
filename: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The object type, which is always "upload".
|
|
100
|
+
*/
|
|
101
|
+
object: 'upload';
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The intended purpose of the file.
|
|
105
|
+
* [Please refer here](https://platform.openai.com/docs/api-reference/files/object#files/object-purpose)
|
|
106
|
+
* for acceptable values.
|
|
107
|
+
*/
|
|
108
|
+
purpose: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The status of the Upload.
|
|
112
|
+
*/
|
|
113
|
+
status: 'pending' | 'completed' | 'cancelled' | 'expired';
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The ready File object after the Upload is completed.
|
|
117
|
+
*/
|
|
118
|
+
file?: FilesAPI.FileObject | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface UploadCreateParams {
|
|
122
|
+
/**
|
|
123
|
+
* The number of bytes in the file you are uploading.
|
|
124
|
+
*/
|
|
125
|
+
bytes: number;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The name of the file to upload.
|
|
129
|
+
*/
|
|
130
|
+
filename: string;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The MIME type of the file.
|
|
134
|
+
*
|
|
135
|
+
* This must fall within the supported MIME types for your file purpose. See the
|
|
136
|
+
* supported MIME types for assistants and vision.
|
|
137
|
+
*/
|
|
138
|
+
mime_type: string;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The intended purpose of the uploaded file.
|
|
142
|
+
*
|
|
143
|
+
* See the
|
|
144
|
+
* [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose).
|
|
145
|
+
*/
|
|
146
|
+
purpose: 'assistants' | 'batch' | 'fine-tune' | 'vision';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface UploadCompleteParams {
|
|
150
|
+
/**
|
|
151
|
+
* The ordered list of Part IDs.
|
|
152
|
+
*/
|
|
153
|
+
part_ids: Array<string>;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The optional md5 checksum for the file contents to verify if the bytes uploaded
|
|
157
|
+
* matches what you expect.
|
|
158
|
+
*/
|
|
159
|
+
md5?: string;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export namespace Uploads {
|
|
163
|
+
export import Upload = UploadsAPI.Upload;
|
|
164
|
+
export import UploadCreateParams = UploadsAPI.UploadCreateParams;
|
|
165
|
+
export import UploadCompleteParams = UploadsAPI.UploadCompleteParams;
|
|
166
|
+
export import Parts = PartsAPI.Parts;
|
|
167
|
+
export import UploadPart = PartsAPI.UploadPart;
|
|
168
|
+
export import PartCreateParams = PartsAPI.PartCreateParams;
|
|
169
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.53.0'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.53.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '4.
|
|
1
|
+
export const VERSION = '4.53.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|