@inductiv/node-red-openai-api 1.87.3 → 1.103.0-patch.1
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 +20 -40
- package/examples/responses/mcp.json +87 -0
- package/gulpfile.js +15 -0
- package/lib.js +16420 -538
- package/locales/en-US/node.json +10 -0
- package/node.html +3050 -3842
- package/node.js +3 -2
- package/package.json +13 -2
- package/src/assistants/help.html +353 -0
- package/src/assistants/methods.js +47 -0
- package/src/assistants/template.html +38 -0
- package/src/audio/help.html +193 -0
- package/src/audio/methods.js +38 -0
- package/src/audio/template.html +14 -0
- package/src/batch/help.html +97 -0
- package/src/batch/methods.js +39 -0
- package/src/batch/template.html +19 -0
- package/src/chat/help.html +436 -0
- package/src/chat/methods.js +82 -0
- package/src/chat/template.html +30 -0
- package/src/container-files/help.html +144 -0
- package/src/container-files/methods.js +60 -0
- package/src/container-files/template.html +7 -0
- package/src/containers/help.html +96 -0
- package/src/containers/methods.js +34 -0
- package/src/containers/template.html +6 -0
- package/src/embeddings/help.html +57 -0
- package/src/embeddings/methods.js +12 -0
- package/src/embeddings/template.html +6 -0
- package/src/files/help.html +102 -0
- package/src/files/methods.js +52 -0
- package/src/files/template.html +22 -0
- package/src/fine-tuning/help.html +187 -0
- package/src/fine-tuning/methods.js +68 -0
- package/src/fine-tuning/template.html +26 -0
- package/src/images/help.html +208 -0
- package/src/images/methods.js +38 -0
- package/src/images/template.html +14 -0
- package/src/lib.js +60 -0
- package/src/messages/help.html +194 -0
- package/src/messages/methods.js +61 -0
- package/src/messages/template.html +7 -0
- package/src/models/help.html +47 -0
- package/src/models/methods.js +30 -0
- package/src/models/template.html +14 -0
- package/src/moderations/help.html +31 -0
- package/src/moderations/methods.js +11 -0
- package/src/moderations/template.html +6 -0
- package/src/node.html +250 -0
- package/src/responses/help.html +248 -0
- package/src/responses/methods.js +55 -0
- package/src/responses/template.html +22 -0
- package/src/runs/help.html +563 -0
- package/src/runs/methods.js +157 -0
- package/src/runs/template.html +35 -0
- package/src/threads/help.html +88 -0
- package/src/threads/methods.js +39 -0
- package/src/threads/template.html +18 -0
- package/src/uploads/help.html +116 -0
- package/src/uploads/methods.js +121 -0
- package/src/uploads/template.html +21 -0
- package/src/vector-store-file-batches/help.html +156 -0
- package/src/vector-store-file-batches/methods.js +84 -0
- package/src/vector-store-file-batches/template.html +22 -0
- package/src/vector-store-files/help.html +133 -0
- package/src/vector-store-files/methods.js +53 -0
- package/src/vector-store-files/template.html +18 -0
- package/src/vector-stores/help.html +162 -0
- package/src/vector-stores/methods.js +48 -0
- package/src/vector-stores/template.html +7 -0
- package/locales/de-DE/node.json +0 -144
- package/locales/ja/node.json +0 -144
- package/locales/zh-CN/node.json +0 -144
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🔉 Audio</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/audio" 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 Speech</h4>
|
|
7
|
+
<p>Generates audio from the input text.</p>
|
|
8
|
+
<dl class="message-properties">
|
|
9
|
+
<h4>msg.payload Properties</h4>
|
|
10
|
+
|
|
11
|
+
<dt>
|
|
12
|
+
input
|
|
13
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-input"
|
|
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 text to generate audio for.</dd>
|
|
18
|
+
|
|
19
|
+
<dt>
|
|
20
|
+
model
|
|
21
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-model"
|
|
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>One of the available TTS models: <code>tts-1</code>, <code>tts-1-hd</code> or
|
|
26
|
+
<code>gpt-4o-mini-tts</code>.</dd>
|
|
27
|
+
|
|
28
|
+
<dt>
|
|
29
|
+
voice
|
|
30
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-voice"
|
|
31
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
32
|
+
<span class="property-type">string</span>
|
|
33
|
+
</dt>
|
|
34
|
+
<dd>
|
|
35
|
+
The voice to use when generating the audio. Supported voices are <code>alloy</code>, <code>ash</code>,
|
|
36
|
+
<code>coral</code>, <code>echo</code>, <code>fable</code>, <code>onyx</code>, <code>nova</code>,
|
|
37
|
+
<code>sage</code> and <code>shimmer</code>.
|
|
38
|
+
</dd>
|
|
39
|
+
|
|
40
|
+
<dt class="optional">
|
|
41
|
+
instructions
|
|
42
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-instructions"
|
|
43
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
44
|
+
<span class="property-type">string</span>
|
|
45
|
+
</dt>
|
|
46
|
+
<dd>
|
|
47
|
+
Control the voice of your generated audio with additional instructions. Does not work with
|
|
48
|
+
<code>tts-1</code> or <code>tts-1-hd</code>.
|
|
49
|
+
</dd>
|
|
50
|
+
|
|
51
|
+
<dt class="optional">
|
|
52
|
+
response_format
|
|
53
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-response_format"
|
|
54
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
55
|
+
<span class="property-type">string</span>
|
|
56
|
+
</dt>
|
|
57
|
+
<dd>
|
|
58
|
+
The format to audio in. Supported formats are mp3, opus, aac, flac, wav, and pcm.
|
|
59
|
+
</dd>
|
|
60
|
+
|
|
61
|
+
<dt class="optional">
|
|
62
|
+
speed
|
|
63
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createSpeech#audio-createspeech-speed"
|
|
64
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
65
|
+
<span class="property-type">number</span>
|
|
66
|
+
</dt>
|
|
67
|
+
<dd>
|
|
68
|
+
The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0
|
|
69
|
+
is the default.
|
|
70
|
+
</dd>
|
|
71
|
+
</dl>
|
|
72
|
+
|
|
73
|
+
<h4 style="font-weight: bolder;"> ⋙ Create Transcription</h4>
|
|
74
|
+
<p>Transcribes audio into the input language.</p>
|
|
75
|
+
<dl class="message-properties">
|
|
76
|
+
<h4>msg.payload Properties</h4>
|
|
77
|
+
|
|
78
|
+
<dt>
|
|
79
|
+
file
|
|
80
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-file"
|
|
81
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
82
|
+
<span class="property-type">file</span>
|
|
83
|
+
</dt>
|
|
84
|
+
<dd>
|
|
85
|
+
Absolute path to the file that's being transcribed, in one of these formats: flac, mp3, mp4, mpeg, mpga,
|
|
86
|
+
m4a, ogg, wav, or webm.
|
|
87
|
+
</dd>
|
|
88
|
+
<dt>
|
|
89
|
+
model
|
|
90
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-model"
|
|
91
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
92
|
+
<span class="property-type">string</span>
|
|
93
|
+
</dt>
|
|
94
|
+
<dd>ID of the model to use.</dd>
|
|
95
|
+
<dt class="optional">
|
|
96
|
+
language
|
|
97
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-language"
|
|
98
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
99
|
+
<span class="property-type">string</span>
|
|
100
|
+
</dt>
|
|
101
|
+
<dd>The language of the input audio.</dd>
|
|
102
|
+
<dt class="optional">
|
|
103
|
+
prompt
|
|
104
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-prompt"
|
|
105
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
106
|
+
<span class="property-type">string</span>
|
|
107
|
+
</dt>
|
|
108
|
+
<dd>
|
|
109
|
+
An optional text to guide the model's style or continue a previous audio
|
|
110
|
+
segment.
|
|
111
|
+
</dd>
|
|
112
|
+
<dt class="optional">
|
|
113
|
+
response_format
|
|
114
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-response_format"
|
|
115
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
116
|
+
<span class="property-type">string</span>
|
|
117
|
+
</dt>
|
|
118
|
+
<dd>
|
|
119
|
+
The format of the transcript output, in one of these options: json,
|
|
120
|
+
text, srt, verbose_json, or vtt.
|
|
121
|
+
</dd>
|
|
122
|
+
<dt class="optional">
|
|
123
|
+
temperature
|
|
124
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-temperature"
|
|
125
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
126
|
+
<span class="property-type">number</span>
|
|
127
|
+
</dt>
|
|
128
|
+
<dd>The sampling temperature, between 0 and 1.</dd>
|
|
129
|
+
|
|
130
|
+
<dt class="optional">
|
|
131
|
+
timestamp_granularities
|
|
132
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranscription#audio-createtranscription-timestamp_granularities"
|
|
133
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
134
|
+
<span class="property-type">array</span>
|
|
135
|
+
</dt>
|
|
136
|
+
<dd>The timestamp granularities to populate for this transcription. <code>response_format</code> must be set
|
|
137
|
+
to <code>verbose_json</code> to use timestamp granularities. Either or both of these options are
|
|
138
|
+
supported: <code>word</code>, or <code>segment</code>.</dd>
|
|
139
|
+
</dl>
|
|
140
|
+
|
|
141
|
+
<h4 style="font-weight: bolder;"> ⋙ Create Translation</h4>
|
|
142
|
+
<p>Translates audio into English.</p>
|
|
143
|
+
<dl class="message-properties">
|
|
144
|
+
<h4>msg.payload Properties</h4>
|
|
145
|
+
|
|
146
|
+
<dt>
|
|
147
|
+
file
|
|
148
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranslation#audio-createtranslation-file"
|
|
149
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
150
|
+
<span class="property-type">file</span>
|
|
151
|
+
</dt>
|
|
152
|
+
<dd>
|
|
153
|
+
Absolute path to the file that's being translated, in one of these formats: flac, mp3, mp4, mpeg, mpga,
|
|
154
|
+
m4a, ogg, wav, or webm.
|
|
155
|
+
</dd>
|
|
156
|
+
<dt>
|
|
157
|
+
model
|
|
158
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranslation#audio-createtranslation-model"
|
|
159
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
160
|
+
<span class="property-type"></span>
|
|
161
|
+
</dt>
|
|
162
|
+
<dd>ID of the model to use.</dd>
|
|
163
|
+
<dt class="optional">
|
|
164
|
+
prompt
|
|
165
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranslation#audio-createtranslation-prompt"
|
|
166
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
167
|
+
<span class="property-type">string</span>
|
|
168
|
+
</dt>
|
|
169
|
+
<dd>
|
|
170
|
+
An optional text to guide the model's style or continue a previous audio
|
|
171
|
+
segment.
|
|
172
|
+
</dd>
|
|
173
|
+
<dt class="optional">
|
|
174
|
+
response_format
|
|
175
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranslation#audio-createtranslation-response_format"
|
|
176
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
177
|
+
<span class="property-type">string</span>
|
|
178
|
+
</dt>
|
|
179
|
+
<dd>
|
|
180
|
+
The format of the transcript output, in one of these options: json,
|
|
181
|
+
text, srt, verbose_json, or vtt.
|
|
182
|
+
</dd>
|
|
183
|
+
<dt class="optional">
|
|
184
|
+
temperature
|
|
185
|
+
<a href="https://platform.openai.com/docs/api-reference/audio/createTranslation#audio-createtranslation-temperature"
|
|
186
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
187
|
+
<span class="property-type">number</span>
|
|
188
|
+
</dt>
|
|
189
|
+
<dd>The sampling temperature, between 0 and 1.</dd>
|
|
190
|
+
</dl>
|
|
191
|
+
|
|
192
|
+
</details>
|
|
193
|
+
</section>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
async function createSpeech(parameters) {
|
|
5
|
+
const openai = new OpenAI(this.clientParams);
|
|
6
|
+
const audio = await openai.audio.speech.create(parameters.payload);
|
|
7
|
+
const response = Buffer.from(await audio.arrayBuffer());
|
|
8
|
+
|
|
9
|
+
return response;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function createTranscription(parameters) {
|
|
13
|
+
const openai = new OpenAI(this.clientParams);
|
|
14
|
+
let { file, ...params } = parameters.payload;
|
|
15
|
+
|
|
16
|
+
params.file = fs.createReadStream(file);
|
|
17
|
+
|
|
18
|
+
const response = await openai.audio.transcriptions.create(params);
|
|
19
|
+
|
|
20
|
+
return response;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function createTranslation(parameters) {
|
|
24
|
+
const openai = new OpenAI(this.clientParams);
|
|
25
|
+
let { file, ...params } = parameters.payload;
|
|
26
|
+
|
|
27
|
+
params.file = fs.createReadStream(file);
|
|
28
|
+
|
|
29
|
+
const response = await openai.audio.translations.create(params);
|
|
30
|
+
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
createSpeech,
|
|
36
|
+
createTranscription,
|
|
37
|
+
createTranslation,
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="🔉 Audio">
|
|
2
|
+
<option
|
|
3
|
+
value="createSpeech"
|
|
4
|
+
data-i18n="OpenaiApi.parameters.createSpeech"
|
|
5
|
+
></option>
|
|
6
|
+
<option
|
|
7
|
+
value="createTranscription"
|
|
8
|
+
data-i18n="OpenaiApi.parameters.createTranscription"
|
|
9
|
+
></option>
|
|
10
|
+
<option
|
|
11
|
+
value="createTranslation"
|
|
12
|
+
data-i18n="OpenaiApi.parameters.createTranslation"
|
|
13
|
+
></option>
|
|
14
|
+
</optgroup>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">📦 Batch</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/batch" 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 Batch</h4>
|
|
7
|
+
<p>Creates and executes a batch from an uploaded file of requests.</p>
|
|
8
|
+
<dl class="message-properties">
|
|
9
|
+
<h4>msg.payload Properties</h4>
|
|
10
|
+
|
|
11
|
+
<dt>
|
|
12
|
+
input_file_id
|
|
13
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/create#batch-create-input_file_id"
|
|
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 ID of an uploaded file that contains requests for the new batch.</dd>
|
|
18
|
+
<dt>
|
|
19
|
+
endpoint
|
|
20
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/create#batch-create-endpoint"
|
|
21
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
22
|
+
<span class="property-type">string</span>
|
|
23
|
+
</dt>
|
|
24
|
+
<dd>The endpoint to be used for all requests in the batch. Currently only /v1/chat/completions is supported.
|
|
25
|
+
</dd>
|
|
26
|
+
<dt>
|
|
27
|
+
completion_window
|
|
28
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/create#batch-create-completion_window"
|
|
29
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
30
|
+
<span class="property-type">string</span>
|
|
31
|
+
</dt>
|
|
32
|
+
<dd>
|
|
33
|
+
The time frame within which the batch should be processed. Currently only 24h is supported.
|
|
34
|
+
</dd>
|
|
35
|
+
<dt class="optional">
|
|
36
|
+
metadata
|
|
37
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/create#batch-create-metadata"
|
|
38
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
39
|
+
<span class="property-type">string</span>
|
|
40
|
+
</dt>
|
|
41
|
+
<dd>
|
|
42
|
+
Optional custom metadata for the batch.
|
|
43
|
+
</dd>
|
|
44
|
+
</dl>
|
|
45
|
+
|
|
46
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve Batch</h4>
|
|
47
|
+
<p>Retrieves a batch.</p>
|
|
48
|
+
<dl class="message-properties">
|
|
49
|
+
<h4>msg.payload Properties</h4>
|
|
50
|
+
|
|
51
|
+
<dt>
|
|
52
|
+
batch_id
|
|
53
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/retrieve#batch-retrieve-batch_id"
|
|
54
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
55
|
+
<span class="property-type">string</span>
|
|
56
|
+
</dt>
|
|
57
|
+
<dd>The ID of the batch to retrieve.</dd>
|
|
58
|
+
</dl>
|
|
59
|
+
|
|
60
|
+
<h4 style="font-weight: bolder;"> ⋙ Cancel Batch</h4>
|
|
61
|
+
<p>Cancels an in-progress batch.</p>
|
|
62
|
+
<dl class="message-properties">
|
|
63
|
+
<h4>msg.payload Properties</h4>
|
|
64
|
+
<dt>
|
|
65
|
+
batch_id
|
|
66
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/cancel#batch-cancel-batch_id"
|
|
67
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
68
|
+
<span class="property-type">string</span>
|
|
69
|
+
</dt>
|
|
70
|
+
<dd>The ID of the batch to cancel.</dd>
|
|
71
|
+
</dl>
|
|
72
|
+
|
|
73
|
+
<h4 style="font-weight: bolder;"> ⋙ List Batch</h4>
|
|
74
|
+
<p>List your organization's batches.</p>
|
|
75
|
+
<dl class="message-properties">
|
|
76
|
+
<h4>msg.payload Properties</h4>
|
|
77
|
+
<dt class="optional">
|
|
78
|
+
after
|
|
79
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/list#batch-list-after" target="_blank"><i
|
|
80
|
+
class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
81
|
+
<span class="property-type">string</span>
|
|
82
|
+
</dt>
|
|
83
|
+
<dd>A cursor for use in pagination. after is an object ID that defines your place in the list.</dd>
|
|
84
|
+
|
|
85
|
+
<dt class="optional">
|
|
86
|
+
limit
|
|
87
|
+
<a href="https://platform.openai.com/docs/api-reference/batch/list#batch-list-limit" target="_blank"><i
|
|
88
|
+
class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
89
|
+
<span class="property-type">integer</span>
|
|
90
|
+
</dt>
|
|
91
|
+
<dd>A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is
|
|
92
|
+
20.</dd>
|
|
93
|
+
</dl>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</details>
|
|
97
|
+
</section>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
|
|
3
|
+
async function createBatch(parameters) {
|
|
4
|
+
const openai = new OpenAI(this.clientParams);
|
|
5
|
+
const response = await openai.batches.create(parameters.payload);
|
|
6
|
+
|
|
7
|
+
return response;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function retrieveBatch(parameters) {
|
|
11
|
+
const openai = new OpenAI(this.clientParams);
|
|
12
|
+
const { batch_id, ...params } = parameters.payload;
|
|
13
|
+
const response = await openai.batches.retrieve(batch_id, params);
|
|
14
|
+
|
|
15
|
+
return response;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function listBatch(parameters) {
|
|
19
|
+
const openai = new OpenAI(this.clientParams);
|
|
20
|
+
const list = await openai.batches.list(parameters.payload);
|
|
21
|
+
const batches = [...list.data];
|
|
22
|
+
|
|
23
|
+
return batches;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function cancelBatch(parameters) {
|
|
27
|
+
const openai = new OpenAI(this.clientParams);
|
|
28
|
+
const { batch_id, ...params } = parameters.payload;
|
|
29
|
+
const response = await openai.batches.cancel(batch_id, params);
|
|
30
|
+
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
createBatch,
|
|
36
|
+
retrieveBatch,
|
|
37
|
+
listBatch,
|
|
38
|
+
cancelBatch,
|
|
39
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- Batch Endpoint-->
|
|
2
|
+
<optgroup style="font-style: normal;" label="📦 Batch">
|
|
3
|
+
<option
|
|
4
|
+
value="createBatch"
|
|
5
|
+
data-i18n="OpenaiApi.parameters.createBatch"
|
|
6
|
+
></option>
|
|
7
|
+
<option
|
|
8
|
+
value="retrieveBatch"
|
|
9
|
+
data-i18n="OpenaiApi.parameters.retrieveBatch"
|
|
10
|
+
></option>
|
|
11
|
+
<option
|
|
12
|
+
value="cancelBatch"
|
|
13
|
+
data-i18n="OpenaiApi.parameters.cancelBatch"
|
|
14
|
+
></option>
|
|
15
|
+
<option
|
|
16
|
+
value="listBatch"
|
|
17
|
+
data-i18n="OpenaiApi.parameters.listBatch"
|
|
18
|
+
></option>
|
|
19
|
+
</optgroup>
|