@inductiv/node-red-openai-api 1.89.0 → 1.103.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.
Files changed (73) hide show
  1. package/README.md +11 -15
  2. package/examples/responses/mcp.json +87 -0
  3. package/gulpfile.js +15 -0
  4. package/lib.js +16375 -539
  5. package/locales/en-US/node.json +9 -0
  6. package/node.html +3037 -3839
  7. package/node.js +3 -2
  8. package/package.json +13 -2
  9. package/src/assistants/help.html +353 -0
  10. package/src/assistants/methods.js +47 -0
  11. package/src/assistants/template.html +38 -0
  12. package/src/audio/help.html +193 -0
  13. package/src/audio/methods.js +38 -0
  14. package/src/audio/template.html +14 -0
  15. package/src/batch/help.html +97 -0
  16. package/src/batch/methods.js +39 -0
  17. package/src/batch/template.html +19 -0
  18. package/src/chat/help.html +436 -0
  19. package/src/chat/methods.js +82 -0
  20. package/src/chat/template.html +30 -0
  21. package/src/container-files/help.html +144 -0
  22. package/src/container-files/methods.js +60 -0
  23. package/src/container-files/template.html +7 -0
  24. package/src/containers/help.html +96 -0
  25. package/src/containers/methods.js +34 -0
  26. package/src/containers/template.html +6 -0
  27. package/src/embeddings/help.html +57 -0
  28. package/src/embeddings/methods.js +12 -0
  29. package/src/embeddings/template.html +6 -0
  30. package/src/files/help.html +102 -0
  31. package/src/files/methods.js +52 -0
  32. package/src/files/template.html +22 -0
  33. package/src/fine-tuning/help.html +187 -0
  34. package/src/fine-tuning/methods.js +68 -0
  35. package/src/fine-tuning/template.html +26 -0
  36. package/src/images/help.html +208 -0
  37. package/src/images/methods.js +38 -0
  38. package/src/images/template.html +14 -0
  39. package/src/lib.js +58 -0
  40. package/src/messages/help.html +174 -0
  41. package/src/messages/methods.js +48 -0
  42. package/src/messages/template.html +18 -0
  43. package/src/models/help.html +47 -0
  44. package/src/models/methods.js +30 -0
  45. package/src/models/template.html +14 -0
  46. package/src/moderations/help.html +31 -0
  47. package/src/moderations/methods.js +11 -0
  48. package/src/moderations/template.html +6 -0
  49. package/src/node.html +250 -0
  50. package/src/responses/help.html +248 -0
  51. package/src/responses/methods.js +55 -0
  52. package/src/responses/template.html +22 -0
  53. package/src/runs/help.html +563 -0
  54. package/src/runs/methods.js +157 -0
  55. package/src/runs/template.html +35 -0
  56. package/src/threads/help.html +88 -0
  57. package/src/threads/methods.js +39 -0
  58. package/src/threads/template.html +18 -0
  59. package/src/uploads/help.html +116 -0
  60. package/src/uploads/methods.js +121 -0
  61. package/src/uploads/template.html +21 -0
  62. package/src/vector-store-file-batches/help.html +156 -0
  63. package/src/vector-store-file-batches/methods.js +84 -0
  64. package/src/vector-store-file-batches/template.html +22 -0
  65. package/src/vector-store-files/help.html +133 -0
  66. package/src/vector-store-files/methods.js +59 -0
  67. package/src/vector-store-files/template.html +18 -0
  68. package/src/vector-stores/help.html +162 -0
  69. package/src/vector-stores/methods.js +54 -0
  70. package/src/vector-stores/template.html +22 -0
  71. package/locales/de-DE/node.json +0 -144
  72. package/locales/ja/node.json +0 -144
  73. package/locales/zh-CN/node.json +0 -144
@@ -0,0 +1,157 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function createThreadAndRun(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+ const { _node, ...params } = parameters;
6
+ const response = await openai.beta.threads.createAndRun(params.payload);
7
+
8
+ if (params.payload.stream) {
9
+ _node.status({
10
+ fill: "green",
11
+ shape: "dot",
12
+ text: "OpenaiApi.status.streaming",
13
+ });
14
+ for await (const chunk of response) {
15
+ if (typeof chunk === "object") {
16
+ const newMsg = { ...parameters.msg, payload: chunk.data };
17
+ _node.send(newMsg);
18
+ }
19
+ }
20
+ _node.status({});
21
+ } else {
22
+ return response;
23
+ }
24
+ }
25
+
26
+ async function listRuns(parameters) {
27
+ const openai = new OpenAI(this.clientParams);
28
+ const { thread_id, ...params } = parameters.payload;
29
+ const list = await openai.beta.threads.runs.list(thread_id, params);
30
+
31
+ return [...list.data];
32
+ }
33
+
34
+ async function createRun(parameters) {
35
+ const openai = new OpenAI(this.clientParams);
36
+ const { _node, ..._params } = parameters;
37
+ const { thread_id, ...params } = _params.payload;
38
+ const response = await openai.beta.threads.runs.create(thread_id, params);
39
+
40
+ if (params.stream) {
41
+ _node.status({
42
+ fill: "green",
43
+ shape: "dot",
44
+ text: "OpenaiApi.status.streaming",
45
+ });
46
+ for await (const chunk of response) {
47
+ if (typeof chunk === "object") {
48
+ const newMsg = { ...parameters.msg, payload: chunk.data };
49
+ _node.send(newMsg);
50
+ }
51
+ }
52
+ _node.status({});
53
+ } else {
54
+ return response;
55
+ }
56
+ }
57
+
58
+ async function getRun(parameters) {
59
+ const openai = new OpenAI(this.clientParams);
60
+ const { thread_id, run_id, ...params } = parameters.payload;
61
+ const response = await openai.beta.threads.runs.retrieve(
62
+ thread_id,
63
+ run_id,
64
+ params
65
+ );
66
+
67
+ return response;
68
+ }
69
+
70
+ async function modifyRun(parameters) {
71
+ const openai = new OpenAI(this.clientParams);
72
+ const { thread_id, run_id, ...params } = parameters.payload;
73
+ const response = await openai.beta.threads.runs.update(
74
+ thread_id,
75
+ run_id,
76
+ params
77
+ );
78
+
79
+ return response;
80
+ }
81
+
82
+ async function submitToolOutputsToRun(parameters) {
83
+ const openai = new OpenAI(this.clientParams);
84
+ const { _node, ..._params } = parameters;
85
+ const { thread_id, run_id, ...params } = _params.payload;
86
+ const response = await openai.beta.threads.runs.submitToolOutputs(
87
+ thread_id,
88
+ run_id,
89
+ params
90
+ );
91
+
92
+ if (params.stream) {
93
+ _node.status({
94
+ fill: "green",
95
+ shape: "dot",
96
+ text: "OpenaiApi.status.streaming",
97
+ });
98
+ for await (const chunk of response) {
99
+ if (typeof chunk === "object") {
100
+ const newMsg = { ...parameters.msg, payload: chunk.data };
101
+ _node.send(newMsg);
102
+ }
103
+ }
104
+ _node.status({});
105
+ } else {
106
+ return response;
107
+ }
108
+ }
109
+
110
+ async function cancelRun(parameters) {
111
+ const openai = new OpenAI(this.clientParams);
112
+ const { thread_id, run_id, ...params } = parameters.payload;
113
+ const response = await openai.beta.threads.runs.cancel(
114
+ thread_id,
115
+ run_id,
116
+ params
117
+ );
118
+
119
+ return response;
120
+ }
121
+
122
+ async function listRunSteps(parameters) {
123
+ const openai = new OpenAI(this.clientParams);
124
+ const { thread_id, run_id, ...params } = parameters.payload;
125
+ const list = await openai.beta.threads.runs.steps.list(
126
+ thread_id,
127
+ run_id,
128
+ params
129
+ );
130
+
131
+ return [...list.data];
132
+ }
133
+
134
+ async function getRunStep(parameters) {
135
+ const openai = new OpenAI(this.clientParams);
136
+ const { thread_id, run_id, step_id, ...params } = parameters.payload;
137
+ const response = await openai.beta.threads.runs.steps.retrieve(
138
+ thread_id,
139
+ run_id,
140
+ step_id,
141
+ params
142
+ );
143
+
144
+ return response;
145
+ }
146
+
147
+ module.exports = {
148
+ createThreadAndRun,
149
+ listRuns,
150
+ createRun,
151
+ getRun,
152
+ modifyRun,
153
+ submitToolOutputsToRun,
154
+ cancelRun,
155
+ listRunSteps,
156
+ getRunStep,
157
+ };
@@ -0,0 +1,35 @@
1
+ <optgroup style="font-style: normal;" label="🔄 Runs (Beta)">
2
+ <option
3
+ value="createThreadAndRun"
4
+ data-i18n="OpenaiApi.parameters.createThreadAndRun"
5
+ ></option>
6
+ <option
7
+ value="listRuns"
8
+ data-i18n="OpenaiApi.parameters.listRuns"
9
+ ></option>
10
+ <option
11
+ value="createRun"
12
+ data-i18n="OpenaiApi.parameters.createRun"
13
+ ></option>
14
+ <option value="getRun" data-i18n="OpenaiApi.parameters.getRun"></option>
15
+ <option
16
+ value="modifyRun"
17
+ data-i18n="OpenaiApi.parameters.modifyRun"
18
+ ></option>
19
+ <option
20
+ value="submitToolOutputsToRun"
21
+ data-i18n="OpenaiApi.parameters.submitToolOutputsToRun"
22
+ ></option>
23
+ <option
24
+ value="cancelRun"
25
+ data-i18n="OpenaiApi.parameters.cancelRun"
26
+ ></option>
27
+ <option
28
+ value="listRunSteps"
29
+ data-i18n="OpenaiApi.parameters.listRunSteps"
30
+ ></option>
31
+ <option
32
+ value="getRunStep"
33
+ data-i18n="OpenaiApi.parameters.getRunStep"
34
+ ></option>
35
+ </optgroup>
@@ -0,0 +1,88 @@
1
+ <section>
2
+ <details>
3
+ <summary style="font-weight: bold;">🧵 Threads</summary>
4
+ <a href="https://platform.openai.com/docs/api-reference/threads" target="_blank">Official Documentation
5
+ <i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
6
+ <h4 style="font-weight: bolder;"> ⋙ Create Thread</h4>
7
+ <p>Create a thread.</p>
8
+ <dl class="message-properties">
9
+ <h4>msg.payload Properties</h4>
10
+
11
+ <dt class="optional">
12
+ messages
13
+ <a href="https://platform.openai.com/docs/api-reference/threads/createThread#threads-createthread-messages"
14
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
15
+ <span class="property-type">array</span>
16
+ </dt>
17
+ <dd>A list of messages to start the thread with.</dd>
18
+
19
+ <dt class="optional">
20
+ tool_resources
21
+ <a href="https://platform.openai.com/docs/api-reference/threads/createThread#threads-createthread-tool_resources"
22
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
23
+ <span class="property-type">array</span>
24
+ </dt>
25
+ <dd>A set of resources that are made available to the assistant's tools in this thread.</dd>
26
+
27
+ <dt class="optional">
28
+ metadata
29
+ <a href="https://platform.openai.com/docs/api-reference/threads/createThread#threads-createthread-metadata"
30
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
31
+ <span class="property-type">object</span>
32
+ </dt>
33
+ <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
34
+ </dl>
35
+
36
+ <h4 style="font-weight: bolder;"> ⋙ Retrieve Thread</h4>
37
+ <p>Retrieves a thread.</p>
38
+ <dl class="message-properties">
39
+ <h4>msg.payload Properties</h4>
40
+
41
+ <dt>
42
+ thread_id
43
+ <a href="https://platform.openai.com/docs/api-reference/threads/getThread#threads-getthread-thread_id"
44
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
45
+ <span class="property-type">string</span>
46
+ </dt>
47
+ <dd>The ID of the thread to retrieve.</dd>
48
+ </dl>
49
+
50
+ <h4 style="font-weight: bolder;"> ⋙ Modify Thread</h4>
51
+ <p>Modifies a thread.</p>
52
+ <dl class="message-properties">
53
+ <h4>msg.payload Properties</h4>
54
+
55
+ <dt>
56
+ thread_id
57
+ <a href="https://platform.openai.com/docs/api-reference/threads/modifyThread#threads-modifythread-thread_id"
58
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
59
+ <span class="property-type">string</span>
60
+ </dt>
61
+ <dd>
62
+ The ID of the thread to modify. Only the metadata can be modified.
63
+ </dd>
64
+ <dt class="optional">
65
+ metadata
66
+ <a href="https://platform.openai.com/docs/api-reference/threads/modifyThread#threads-modifythread-metadata"
67
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
68
+ <span class="property-type">object</span>
69
+ </dt>
70
+ <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
71
+ </dl>
72
+
73
+ <h4 style="font-weight: bolder;"> ⋙ Delete Thread</h4>
74
+ <p>Delete a thread.</p>
75
+ <dl class="message-properties">
76
+ <h4>msg.payload Properties</h4>
77
+
78
+ <dt>
79
+ thread_id
80
+ <a href="https://platform.openai.com/docs/api-reference/threads/deleteThread#threads-deletethread-thread_id"
81
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
82
+ <span class="property-type">string</span>
83
+ </dt>
84
+ <dd>The ID of the thread to delete.</dd>
85
+ </dl>
86
+
87
+ </details>
88
+ </section>
@@ -0,0 +1,39 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function createThread(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+ const response = await openai.beta.threads.create(parameters.payload);
6
+
7
+ return response;
8
+ }
9
+
10
+ async function getThread(parameters) {
11
+ const openai = new OpenAI(this.clientParams);
12
+ const { thread_id, ...params } = parameters.payload;
13
+ const response = await openai.beta.threads.retrieve(thread_id, params);
14
+
15
+ return response;
16
+ }
17
+
18
+ async function modifyThread(parameters) {
19
+ const openai = new OpenAI(this.clientParams);
20
+ const { thread_id, ...params } = parameters.payload;
21
+ const response = await openai.beta.threads.update(thread_id, params);
22
+
23
+ return response;
24
+ }
25
+
26
+ async function deleteThread(parameters) {
27
+ const openai = new OpenAI(this.clientParams);
28
+ const { thread_id, ...params } = parameters.payload;
29
+ const response = await openai.beta.threads.del(thread_id, params);
30
+
31
+ return response;
32
+ }
33
+
34
+ module.exports = {
35
+ createThread,
36
+ getThread,
37
+ modifyThread,
38
+ deleteThread,
39
+ };
@@ -0,0 +1,18 @@
1
+ <optgroup style="font-style: normal;" label="🧵 Threads (Beta)">
2
+ <option
3
+ value="createThread"
4
+ data-i18n="OpenaiApi.parameters.createThread"
5
+ ></option>
6
+ <option
7
+ value="getThread"
8
+ data-i18n="OpenaiApi.parameters.getThread"
9
+ ></option>
10
+ <option
11
+ value="modifyThread"
12
+ data-i18n="OpenaiApi.parameters.modifyThread"
13
+ ></option>
14
+ <option
15
+ value="deleteThread"
16
+ data-i18n="OpenaiApi.parameters.deleteThread"
17
+ ></option>
18
+ </optgroup>
@@ -0,0 +1,116 @@
1
+ <section>
2
+ <details>
3
+ <summary style="font-weight: bold;">☁️ Uploads</summary>
4
+ <a href="https://platform.openai.com/docs/api-reference/uploads" target="_blank">Official Documentation
5
+ <i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
6
+ <h4 style="font-weight: bolder;"> ⋙ Create Upload</h4>
7
+ <p>Creates an intermediate Upload object that you can add Parts to. </p>
8
+ <dl class="message-properties">
9
+ <h4>msg.payload Properties</h4>
10
+
11
+ <dt>
12
+ filename
13
+ <a href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-filename"
14
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
15
+ <span class="property-type">string</span>
16
+ </dt>
17
+ <dd>The name of the file to upload.</dd>
18
+
19
+ <dt>
20
+ purpose
21
+ <a href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-purpose"
22
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
23
+ <span class="property-type">string</span>
24
+ </dt>
25
+ <dd>The intended purpose of the uploaded file.</dd>
26
+
27
+ <dt>
28
+ bytes
29
+ <a href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-bytes"
30
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
31
+ <span class="property-type">integer</span>
32
+ </dt>
33
+ <dd>The number of bytes in the file you are uploading.</dd>
34
+
35
+ <dt>
36
+ mime_type
37
+ <a href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-mime_type"
38
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
39
+ <span class="property-type">integer</span>
40
+ </dt>
41
+ <dd>This must fall within the supported MIME types for your file purpose.</dd>
42
+
43
+ </dl>
44
+
45
+ <h4 style="font-weight: bolder;"> ⋙ Add Upload Part</h4>
46
+ <p>Adds a Part to an Upload object.</p>
47
+ <dl class="message-properties">
48
+ <h4>msg.payload Properties</h4>
49
+
50
+ <dt>
51
+ upload_id
52
+ <a href="https://platform.openai.com/docs/api-reference/uploads/add-part#uploads-add-part-upload_id"
53
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
54
+ <span class="property-type">string</span>
55
+ </dt>
56
+ <dd>The ID of the Upload.</dd>
57
+
58
+ <dt>
59
+ data
60
+ <a href="https://platform.openai.com/docs/api-reference/uploads/add-part#uploads-add-part-data"
61
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
62
+ <span class="property-type">file</span>
63
+ </dt>
64
+ <dd>The chunk of bytes for this Part.</dd>
65
+
66
+ </dl>
67
+
68
+ <h4 style="font-weight: bolder;"> ⋙ Complete Upload</h4>
69
+ <p>Completes the Upload.</p>
70
+ <dl class="message-properties">
71
+ <h4>msg.payload Properties</h4>
72
+
73
+ <dt>
74
+ upload_id
75
+ <a href="https://platform.openai.com/docs/api-reference/uploads/complete#uploads-complete-upload_id"
76
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
77
+ <span class="property-type">string</span>
78
+ </dt>
79
+ <dd>
80
+ The ID of the Upload.
81
+ </dd>
82
+
83
+ <dt>
84
+ part_ids
85
+ <a href="https://platform.openai.com/docs/api-reference/uploads/complete#uploads-complete-part_ids"
86
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
87
+ <span class="property-type">array</span>
88
+ </dt>
89
+ <dd>The ordered list of Part IDs.</dd>
90
+
91
+ <dt>
92
+ md5
93
+ <a href="https://platform.openai.com/docs/api-reference/uploads/complete#uploads-complete-md5"
94
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
95
+ <span class="property-type">string</span>
96
+ </dt>
97
+ <dd>The optional md5 checksum for the file contents.</dd>
98
+
99
+ </dl>
100
+
101
+ <h4 style="font-weight: bolder;"> ⋙ Cancel Upload</h4>
102
+ <p>Cancels the Upload.</p>
103
+ <dl class="message-properties">
104
+ <h4>msg.payload Properties</h4>
105
+
106
+ <dt>
107
+ upload_id
108
+ <a href="https://platform.openai.com/docs/api-reference/uploads/cancel#uploads-cancel-upload_id"
109
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
110
+ <span class="property-type">string</span>
111
+ </dt>
112
+ <dd>The ID of the Upload.</dd>
113
+ </dl>
114
+
115
+ </details>
116
+ </section>
@@ -0,0 +1,121 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function createUpload(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+
6
+ // Define required parameters
7
+ const required_params = ["filename", "purpose", "bytes", "mime_type"];
8
+
9
+ // Validate that all required parameters are present
10
+ const missing_params = required_params.filter(
11
+ (param) => !parameters.payload?.[param]
12
+ );
13
+ if (missing_params.length > 0) {
14
+ throw new Error(
15
+ `Missing required parameter(s): ${missing_params.join(", ")}`
16
+ );
17
+ }
18
+
19
+ // Destructure and assign the payload to match SDK expectations
20
+ const { filename, purpose, bytes, mime_type, ...optionalParams } =
21
+ parameters.payload;
22
+
23
+ const response = await openai.uploads.create(
24
+ {
25
+ filename,
26
+ purpose,
27
+ bytes,
28
+ mime_type,
29
+ },
30
+ { ...optionalParams }
31
+ );
32
+
33
+ return response;
34
+ }
35
+
36
+ async function addUploadPart(parameters) {
37
+ const clientParams = {
38
+ ...this.clientParams,
39
+ };
40
+
41
+ const openai = new OpenAI(clientParams);
42
+
43
+ // Validate required parameters
44
+ const required_params = ["upload_id", "data"];
45
+ const missing_params = required_params.filter(
46
+ (param) => !parameters.payload?.[param]
47
+ );
48
+ if (missing_params.length > 0) {
49
+ throw new Error(
50
+ `Missing required parameter(s): ${missing_params.join(", ")}`
51
+ );
52
+ }
53
+
54
+ const { upload_id, data, ...optionalParams } = parameters.payload;
55
+ const response = await openai.uploads.parts.create(upload_id, data, {
56
+ ...optionalParams,
57
+ });
58
+
59
+ return response;
60
+ }
61
+
62
+ async function completeUpload(parameters) {
63
+ const clientParams = {
64
+ ...this.clientParams,
65
+ };
66
+
67
+ const openai = new OpenAI(clientParams);
68
+
69
+ // Validate required parameters
70
+ const required_params = ["upload_id", "part_ids"];
71
+ const missing_params = required_params.filter(
72
+ (param) => !parameters.payload?.[param]
73
+ );
74
+ if (missing_params.length > 0) {
75
+ throw new Error(
76
+ `Missing required parameter(s): ${missing_params.join(", ")}`
77
+ );
78
+ }
79
+
80
+ const { upload_id, part_ids, ...optionalParams } = parameters.payload;
81
+ const response = await openai.uploads.complete(
82
+ upload_id,
83
+ { part_ids },
84
+ { ...optionalParams }
85
+ );
86
+
87
+ return response;
88
+ }
89
+
90
+ async function cancelUpload(parameters) {
91
+ const clientParams = {
92
+ ...this.clientParams,
93
+ };
94
+
95
+ const openai = new OpenAI(clientParams);
96
+
97
+ // Validate required parameters
98
+ const required_params = ["upload_id"];
99
+ const missing_params = required_params.filter(
100
+ (param) => !parameters.payload?.[param]
101
+ );
102
+ if (missing_params.length > 0) {
103
+ throw new Error(
104
+ `Missing required parameter(s): ${missing_params.join(", ")}`
105
+ );
106
+ }
107
+
108
+ const { upload_id, ...optionalParams } = parameters.payload;
109
+ const response = await openai.uploads.cancel(upload_id, {
110
+ ...optionalParams,
111
+ });
112
+
113
+ return response;
114
+ }
115
+
116
+ module.exports = {
117
+ createUpload,
118
+ addUploadPart,
119
+ completeUpload,
120
+ cancelUpload,
121
+ };
@@ -0,0 +1,21 @@
1
+ <optgroup style="font-style: normal;" label="☁️ Uploads">
2
+ <option
3
+ value="createUpload"
4
+ data-i18n="OpenaiApi.parameters.createUpload"
5
+ ></option>
6
+
7
+ <option
8
+ value="addUploadPart"
9
+ data-i18n="OpenaiApi.parameters.addUploadPart"
10
+ ></option>
11
+
12
+ <option
13
+ value="completeUpload"
14
+ data-i18n="OpenaiApi.parameters.completeUpload"
15
+ ></option>
16
+
17
+ <option
18
+ value="cancelUpload"
19
+ data-i18n="OpenaiApi.parameters.cancelUpload"
20
+ ></option>
21
+ </optgroup>