@inductiv/node-red-openai-api 0.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/node.html ADDED
@@ -0,0 +1,771 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType('openai-api', {
3
+ category: 'AI',
4
+ color: '#B8B1FB',
5
+ defaults: {
6
+ name: { value: "" },
7
+ service: { value: "", type: "openai-api-service", required: true },
8
+ method: { value: "", required: true }
9
+ },
10
+ inputs: 1,
11
+ outputs: 1,
12
+ icon: 'icon.png',
13
+ label: function () {
14
+ return this.name || this.method || "openai-api";
15
+ },
16
+ labelStyle: function () {
17
+ return this.name ? "node_label_italic" : "";
18
+ },
19
+ oneditprepare: function () {
20
+ var selectedMethod = $('#node-input-method option:selected');
21
+ if (!selectedMethod.val()) {
22
+ var methods = $('#node-input-method').children();
23
+ var firstMethod = methods.first();
24
+ $('#node-input-method').val(firstMethod.val());
25
+ }
26
+ }
27
+ });
28
+ </script>
29
+
30
+ <script type="text/html" data-template-name="openai-api">
31
+ <div class="form-row">
32
+ <label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
33
+ <input type="text" id="node-input-name" data-i18n="[placeholder]node-red:common.label.name">
34
+ </div>
35
+ <hr/>
36
+
37
+ <div class="form-row">
38
+ <label for="node-input-service"><i class="fa fa-cloud"></i> <span data-i18n="OpenaiApi.label.service"></span></label>
39
+ <input type="text" id="node-input-service">
40
+ </div>
41
+
42
+ <div class="form-row">
43
+ <label for="node-input-method"><i class="fa fa-tasks"></i> <span data-i18n="OpenaiApi.label.method"></span></label>
44
+ <select id="node-input-method">
45
+ <optgroup style="font-style: normal;" label="๐Ÿค– Assistants (Beta)">
46
+ <option value="createAssistant" data-i18n="OpenaiApi.parameters.createAssistant"></option>
47
+ <option value="getAssistant" data-i18n="OpenaiApi.parameters.getAssistant"></option>
48
+ <option value="modifyAssistant" data-i18n="OpenaiApi.parameters.modifyAssistant"></option>
49
+ <option value="deleteAssistant" data-i18n="OpenaiApi.parameters.deleteAssistant"></option>
50
+ <option value="listAssistants" data-i18n="OpenaiApi.parameters.listAssistants"></option>
51
+ <option value="listAssistantFiles" data-i18n="OpenaiApi.parameters.listAssistantFiles"></option>
52
+ <option value="createAssistantFile" data-i18n="OpenaiApi.parameters.createAssistantFile"></option>
53
+ <option value="getAssistantFile" data-i18n="OpenaiApi.parameters.getAssistantFile"></option>
54
+ <option value="deleteAssistantFile" data-i18n="OpenaiApi.parameters.deleteAssistantFile"></option>
55
+ </optgroup>
56
+ <optgroup style="font-style: normal;" label="๐Ÿ”‰ Audio">
57
+ <option value="createSpeech" data-i18n="OpenaiApi.parameters.createSpeech"></option>
58
+ <option value="createTranscription" data-i18n="OpenaiApi.parameters.createTranscription"></option>
59
+ <option value="createTranslation" data-i18n="OpenaiApi.parameters.createTranslation"></option>
60
+ </optgroup>
61
+ <optgroup style="font-style: normal;" label="๐Ÿ—จ๏ธ Chat">
62
+ <option value="createChatCompletion" data-i18n="OpenaiApi.parameters.createChatCompletion"></option>
63
+ </optgroup>
64
+ <optgroup style="font-style: normal;" label="๐Ÿ”— Embeddings">
65
+ <option value="createEmbedding" data-i18n="OpenaiApi.parameters.createEmbedding"></option>
66
+ </optgroup>
67
+ <optgroup style="font-style: normal;" label="๐Ÿ”ง Fine-tuning">
68
+ <option value="createFineTuningJob" data-i18n="OpenaiApi.parameters.createFineTuningJob"></option>
69
+ <option value="listPaginatedFineTuningJobs" data-i18n="OpenaiApi.parameters.listPaginatedFineTuningJobs"></option>
70
+ <option value="retrieveFineTuningJob" data-i18n="OpenaiApi.parameters.retrieveFineTuningJob"></option>
71
+ <option value="listFineTuningEvents" data-i18n="OpenaiApi.parameters.listFineTuningEvents"></option>
72
+ <option value="cancelFineTuningJob" data-i18n="OpenaiApi.parameters.cancelFineTuningJob"></option>
73
+ </optgroup>
74
+ <optgroup style="font-style: normal;" label="๐Ÿ“ Files">
75
+ <option value="listFiles" data-i18n="OpenaiApi.parameters.listFiles"></option>
76
+ <option value="createFile" data-i18n="OpenaiApi.parameters.createFile"></option>
77
+ <option value="deleteFile" data-i18n="OpenaiApi.parameters.deleteFile"></option>
78
+ <option value="retrieveFile" data-i18n="OpenaiApi.parameters.retrieveFile"></option>
79
+ <option value="downloadFile" data-i18n="OpenaiApi.parameters.downloadFile"></option>
80
+ </optgroup>
81
+ <optgroup style="font-style: normal;" label="๐Ÿ–ผ๏ธ Images">
82
+ <option value="createImage" data-i18n="OpenaiApi.parameters.createImage"></option>
83
+ <option value="createImageEdit" data-i18n="OpenaiApi.parameters.createImageEdit"></option>
84
+ <option value="createImageVariation" data-i18n="OpenaiApi.parameters.createImageVariation"></option>
85
+ </optgroup>
86
+ <optgroup style="font-style: normal;" label="๐Ÿ“Ÿ Messages (Beta)">
87
+ <option value="listMessages" data-i18n="OpenaiApi.parameters.listMessages"></option>
88
+ <option value="createMessage" data-i18n="OpenaiApi.parameters.createMessage"></option>
89
+ <option value="getMessage" data-i18n="OpenaiApi.parameters.getMessage"></option>
90
+ <option value="modifyMessage" data-i18n="OpenaiApi.parameters.modifyMessage"></option>
91
+ <option value="listMessageFiles" data-i18n="OpenaiApi.parameters.listMessageFiles"></option>
92
+ <option value="getMessageFile" data-i18n="OpenaiApi.parameters.getMessageFile"></option>
93
+ </optgroup>
94
+ <optgroup style="font-style: normal;" label="๐Ÿง  Models">
95
+ <option value="listModels" data-i18n="OpenaiApi.parameters.listModels"></option>
96
+ <option value="retrieveModel" data-i18n="OpenaiApi.parameters.retrieveModel"></option>
97
+ <option value="deleteModel" data-i18n="OpenaiApi.parameters.deleteModel"></option>
98
+ </optgroup>
99
+ <optgroup style="font-style: normal;" label="โœ… Moderations">
100
+ <option value="createModeration" data-i18n="OpenaiApi.parameters.createModeration"></option>
101
+ </optgroup>
102
+ <optgroup style="font-style: normal;" label="๐Ÿ”„ Runs (Beta)">
103
+ <option value="createThreadAndRun" data-i18n="OpenaiApi.parameters.createThreadAndRun"></option>
104
+ <option value="listRuns" data-i18n="OpenaiApi.parameters.listRuns"></option>
105
+ <option value="createRun" data-i18n="OpenaiApi.parameters.createRun"></option>
106
+ <option value="getRun" data-i18n="OpenaiApi.parameters.getRun"></option>
107
+ <option value="modifyRun" data-i18n="OpenaiApi.parameters.modifyRun"></option>
108
+ <option value="submitToolOuputsToRun" data-i18n="OpenaiApi.parameters.submitToolOuputsToRun"></option>
109
+ <option value="cancelRun" data-i18n="OpenaiApi.parameters.cancelRun"></option>
110
+ <option value="listRunSteps" data-i18n="OpenaiApi.parameters.listRunSteps"></option>
111
+ <option value="getRunStep" data-i18n="OpenaiApi.parameters.getRunStep"></option>
112
+ </optgroup>
113
+ <optgroup style="font-style: normal;" label="๐Ÿงต Threads (Beta)">
114
+ <option value="createThread" data-i18n="OpenaiApi.parameters.createThread"></option>
115
+ <option value="getThread" data-i18n="OpenaiApi.parameters.getThread"></option>
116
+ <option value="modifyThread" data-i18n="OpenaiApi.parameters.modifyThread"></option>
117
+ <option value="deleteThread" data-i18n="OpenaiApi.parameters.deleteThread"></option>
118
+ </optgroup>
119
+ </select>
120
+ </div>
121
+ </script>
122
+
123
+ <script type="text/html" data-help-name="openai-api">
124
+ <p>OpenAI Platform Services API. Please see the <a href="https://platform.openai.com/docs/api-reference" target="_blank">OpenAI API Reference</a> for more details.</p>
125
+ <p><b>Reference</b></p>
126
+
127
+ <section>
128
+ <h1 style="font-weight: bold;">๐Ÿค– Assistants</h1>
129
+ <a href="https://platform.openai.com/docs/api-reference/assistants" target="_blank">Official Documentation</a>
130
+ <h2>Create Assistant</h2>
131
+ <p>Create an assistant with a model and instructions.</p>
132
+ <dl class="message-properties">
133
+ <h2>msg.payload Properties</h2>
134
+
135
+ <dt>model <span class="property-type">string</span></dt>
136
+ <dt class="optional">name <span class="property-type">string</span></dt>
137
+ <dt class="optional">description <span class="property-type">string</span></dt>
138
+ <dt class="optional">instructions <span class="property-type">string</span></dt>
139
+ <dt class="optional">tools <span class="property-type">array</span></dt>
140
+ <dt class="optional">file_ids <span class="property-type">array</span></dt>
141
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
142
+ </dl>
143
+
144
+ <h2>Retrieve Assistant</h2>
145
+ <p>Retrieves an assistant.</p>
146
+ <dl class="message-properties">
147
+ <h2>msg.payload Properties</h2>
148
+
149
+ <dt>assistant_id <span class="property-type">string</span></dt>
150
+ </dl>
151
+
152
+ <h2>Modify Assistant</h2>
153
+ <p>Modifies an assistant.</p>
154
+ <dl class="message-properties">
155
+ <h2>msg.payload Properties</h2>
156
+
157
+ <dt>assistant_id <span class="property-type">string</span></dt>
158
+
159
+ <dt class="optional">model <span class="property-type">string</span></dt>
160
+ <dt class="optional">name <span class="property-type">string</span></dt>
161
+ <dt class="optional">description <span class="property-type">string</span></dt>
162
+ <dt class="optional">instructions <span class="property-type">string</span></dt>
163
+ <dt class="optional">tools <span class="property-type">array</span></dt>
164
+ <dt class="optional">file_ids <span class="property-type">array</span></dt>
165
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
166
+ </dl>
167
+
168
+ <h2>Delete Assistant</h2>
169
+ <p>Delete an assistant.</p>
170
+ <dl class="message-properties">
171
+ <h2>msg.payload Properties</h2>
172
+
173
+ <dt>assistant_id <span class="property-type">string</span></dt>
174
+ </dl>
175
+
176
+ <h2>List Assistants</h2>
177
+ <p>Returns a list of assistants.</p>
178
+ <dl class="message-properties">
179
+ <h2>msg.payload Properties</h2>
180
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
181
+ <dt class="optional">order <span class="property-type">string</span></dt>
182
+ <dt class="optional">action <span class="property-type">string</span></dt>
183
+ <dt class="optional">before <span class="property-type">string</span></dt>
184
+ </dl>
185
+
186
+ <h2>List Assistant Files</h2>
187
+ <p>Returns a list of assistant files.</p>
188
+ <dl class="message-properties">
189
+ <h2>msg.payload Properties</h2>
190
+
191
+ <dt>assistant_id <span class="property-type">string</span></dt>
192
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
193
+ <dt class="optional">order <span class="property-type">string</span></dt>
194
+ <dt class="optional">after <span class="property-type">string</span></dt>
195
+ <dt class="optional">before <span class="property-type">string</span></dt>
196
+ </dl>
197
+
198
+ <h2>Create Assistant File</h2>
199
+ <p>Create an assistant file by attaching a file to an assistant.</p>
200
+ <dl class="message-properties">
201
+ <h2>msg.payload Properties</h2>
202
+
203
+ <dt>assistant_id <span class="property-type">string</span></dt>
204
+
205
+ <dt>file_id <span class="property-type">string</span></dt>
206
+ </dl>
207
+
208
+ <h2>Retrieve Assistant File</h2>
209
+ <p>Retrieves an AssistantFile.</p>
210
+ <dl class="message-properties">
211
+ <h2>msg.payload Properties</h2>
212
+
213
+ <dt>assistant_id <span class="property-type">string</span></dt>
214
+ <dt>file_id <span class="property-type">string</span></dt>
215
+ </dl>
216
+
217
+ <h2>Delete Assistant File</h2>
218
+ <p>Delete an assistant file.</p>
219
+ <dl class="message-properties">
220
+ <h2>msg.payload Properties</h2>
221
+
222
+ <dt>assistant_id <span class="property-type">string</span></dt>
223
+ <dt>file_id <span class="property-type">string</span></dt>
224
+ </dl>
225
+ </section>
226
+
227
+ <section>
228
+ <h1 style="font-weight: bold;">๐Ÿ”‰ Audio</h1>
229
+ <a href="https://platform.openai.com/docs/api-reference/audio" target="_blank">Official Documentation</a>
230
+ <h2>Create Speech</h2>
231
+ <p>Generates audio from the input text.</p>
232
+ <dl class="message-properties">
233
+ <h2>msg.payload Properties</h2>
234
+
235
+ <dt>model <span class="property-type">string</span></dt>
236
+ <dt>input <span class="property-type">string</span></dt>
237
+ <dt>voice <span class="property-type">string</span></dt>
238
+ <dt class="optional">response_format <span class="property-type">string</span></dt>
239
+ <dt class="optional">speed <span class="property-type">number</span></dt>
240
+ </dl>
241
+
242
+ <h2>Create Transcription</h2>
243
+ <p>Transcribes audio into the input language.</p>
244
+ <dl class="message-properties">
245
+ <h2>msg.payload Properties</h2>
246
+
247
+ <dt>file <span class="property-type">file</span></dt>
248
+
249
+ <dt>model <span class="property-type">string</span></dt>
250
+ <dt class="optional">language <span class="property-type">string</span></dt>
251
+ <dt class="optional">prompt <span class="property-type">string</span></dt>
252
+ <dt class="optional">response_format <span class="property-type">string</span></dt>
253
+ <dt class="optional">temperature <span class="property-type">number</span></dt>
254
+ </dl>
255
+
256
+ <h2>Create Translation</h2>
257
+ <p>Translates audio into English.</p>
258
+ <dl class="message-properties">
259
+ <h2>msg.payload Properties</h2>
260
+
261
+ <dt>file <span class="property-type">file</span></dt>
262
+
263
+ <dt>model <span class="property-type"></span></dt>
264
+ <dt class="optional">prompt <span class="property-type">string</span></dt>
265
+ <dt class="optional">response_format <span class="property-type">string</span></dt>
266
+ <dt class="optional">temperature <span class="property-type">number</span></dt>
267
+ </dl>
268
+ </section>
269
+
270
+ <section>
271
+ <h1 style="font-weight: bold;">๐Ÿ—จ๏ธ Chat</h1>
272
+ <a href="https://platform.openai.com/docs/api-reference/chat" target="_blank">Official Documentation</a>
273
+ <h2>Create Chat Completion</h2>
274
+ <p>Creates a model response for the given chat conversation. <a href="https://platform.openai.com/docs/api-reference/chat/create" target="_blank">Full documentation.</a></p>
275
+ <dl class="message-properties">
276
+ <h2>msg.payload Properties</h2>
277
+
278
+ <dt>messages <span class="property-type">array</span></dt>
279
+ <dt>model <span class="property-type">string</span></dt>
280
+ <dt class="optional">frequency_penalty <span class="property-type">number</span></dt>
281
+ <dt class="optional">logit_bias <span class="property-type">object</span></dt>
282
+ <dt class="optional">max_tokens <span class="property-type">integer</span></dt>
283
+ <dt class="optional">n <span class="property-type">integer</span></dt>
284
+ <dt class="optional">presence_penalty <span class="property-type">number</span></dt>
285
+ <dt class="optional">response_format <span class="property-type">object</span></dt>
286
+ <dt class="optional">seed <span class="property-type">integer</span></dt>
287
+ <dt class="optional">stop <span class="property-type">string | array</span></dt>
288
+ <dt class="optional">stream <span class="property-type">boolean</span></dt>
289
+ <dt class="optional">temperature <span class="property-type">number</span></dt>
290
+ <dt class="optional">top_p <span class="property-type">number</span></dt>
291
+ <dt class="optional">tools <span class="property-type">array</span></dt>
292
+ <dt class="optional">tool_choice <span class="property-type">string | object</span></dt>
293
+ <dt class="optional">user <span class="property-type">string</span></dt>
294
+ </dl>
295
+ </section>
296
+
297
+ <section>
298
+ <h1 style="font-weight: bold;">๐Ÿ”— Embeddings</h1>
299
+ <a href="https://platform.openai.com/docs/api-reference/embeddings" target="_blank">Official Documentation</a>
300
+ <h2>Create Embeddings</h2>
301
+ <p>Creates an embedding vector representing the input text.</p>
302
+ <dl class="message-properties">
303
+ <h2>msg.payload Properties</h2>
304
+
305
+ <dt>input <span class="property-type">string | array</span></dt>
306
+ <dt>model <span class="property-type">string</span></dt>
307
+ <dt class="optional">encoding_format <span class="property-type">string</span></dt>
308
+ <dt class="optional">user <span class="property-type">string</span></dt>
309
+ </dl>
310
+ </section>
311
+
312
+ <section>
313
+ <h1 style="font-weight: bold;">๐Ÿ”ง Fine-tuning</h1>
314
+ <a href="https://platform.openai.com/docs/api-reference/fine-tuning" target="_blank">Official Documentation</a>
315
+ <h2>Create Fine-tuning Job</h2>
316
+ <p>Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.</p>
317
+ <dl class="message-properties">
318
+ <h2>msg.payload Properties</h2>
319
+
320
+ <dt>model <span class="property-type">string</span></dt>
321
+ <dt>training_file <span class="property-type">string</span></dt>
322
+ <dt class="optional">hyperparameters <span class="property-type">object</span></dt>
323
+ <dt class="optional">suffix <span class="property-type">string</span></dt>
324
+ <dt class="optional">validation_file <span class="property-type">string</span></dt>
325
+ </dl>
326
+
327
+ <h2>List Fine-tuning Jobs</h2>
328
+ <p>List your organization's fine-tuning jobs</p>
329
+ <dl class="message-properties">
330
+ <h2>msg.payload Properties</h2>
331
+
332
+ <dt class="optional">after <span class="property-type">string</span></dt>
333
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
334
+ </dl>
335
+
336
+ <h2>Retrieve Fine-tuning Job</h2>
337
+ <p>Get info about a fine-tuning job.</p>
338
+ <dl class="message-properties">
339
+ <h2>msg.payload Properties</h2>
340
+
341
+ <dt>fine_tuning_body <span class="property-type">string</span></dt>
342
+ </dl>
343
+
344
+ <h2>List Fine-tuning Events</h2>
345
+ <p>Get status updates for a fine-tuning job.</p>
346
+ <dl class="message-properties">
347
+ <h2>msg.payload Properties</h2>
348
+
349
+ <dt>fine_tuning_body <span class="property-type">string</span></dt>
350
+ <dt class="optional">after <span class="property-type">string</span></dt>
351
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
352
+ </dl>
353
+
354
+ <h2>Cancel Fine-tuning Job</h2>
355
+ <p>Immediately cancel a fine-tune job.</p>
356
+ <dl class="message-properties">
357
+ <h2>msg.payload Properties</h2>
358
+
359
+ <dt>fine_tuning_body <span class="property-type">string</span></dt>
360
+ </dl>
361
+ </section>
362
+
363
+ <section>
364
+ <h1 style="font-weight: bold;">๐Ÿ“ Files</h1>
365
+ <a href="https://platform.openai.com/docs/api-reference/files" target="_blank">Official Documentation</a>
366
+ <h2>List Files</h2>
367
+ <p>Returns a list of files that belong to the user's organization.</p>
368
+ <dl class="message-properties">
369
+ <h2>msg.payload Properties</h2>
370
+
371
+ <dt class="optional">purpose <span class="property-type">string</span></dt>
372
+ </dl>
373
+
374
+ <h2>Upload File</h2>
375
+ <dl class="message-properties">
376
+ <h2>msg.payload Properties</h2>
377
+
378
+ <dt>file <span class="property-type">file</span></dt>
379
+
380
+ <dt>purpose <span class="property-type">string</span></dt>
381
+ </dl>
382
+
383
+ <h2>Delete File</h2>
384
+ <p>Delete a file.</p>
385
+ <dl class="message-properties">
386
+ <h2>msg.payload Properties</h2>
387
+
388
+ <dt>file_id <span class="property-type">string</span></dt>
389
+ </dl>
390
+
391
+ <h2>Retrieve File</h2>
392
+ <p>Returns information about a specific file.</p>
393
+ <dl class="message-properties">
394
+ <h2>msg.payload Properties</h2>
395
+
396
+ <dt>file_id <span class="property-type">string</span></dt>
397
+ </dl>
398
+
399
+ <h2>Retrieve File Content</h2>
400
+ <p>Returns the contents of the specified file.</p>
401
+ <dl class="message-properties">
402
+ <h2>msg.payload Properties</h2>
403
+
404
+ <dt>file_id <span class="property-type">string</span></dt>
405
+ </dl>
406
+ </section>
407
+
408
+ <section>
409
+ <h1 style="font-weight: bold;">๐Ÿ–ผ๏ธ Images</h1>
410
+ <a href="https://platform.openai.com/docs/api-reference/images" target="_blank">Official Documentation</a>
411
+ <h2>Create Image</h2>
412
+ <p>Creates an image given a prompt.</p>
413
+ <dl class="message-properties">
414
+ <h2>msg.payload Properties</h2>
415
+
416
+ <dt>prompt <span class="property-type">string</span></dt>
417
+ <dt class="optional">model <span class="property-type">string</span></dt>
418
+ <dt class="optional">n <span class="property-type">integer</span></dt>
419
+ <dt class="optional">quality <span class="property-type">string</span></dt>
420
+ <dt class="optional">response_format <span class="property-type">string</span></dt>
421
+ <dt class="optional">size <span class="property-type">string</span></dt>
422
+ <dt class="optional">style <span class="property-type">string</span></dt>
423
+ <dt class="optional">user <span class="property-type">string</span></dt>
424
+ </dl>
425
+
426
+ <h2>Create Image Edit</h2>
427
+ <p>Creates an edited or extended image given an original image and a prompt.</p>
428
+ <dl class="message-properties">
429
+ <h2>msg.payload Properties</h2>
430
+
431
+ <dt>image <span class="property-type">string</span></dt>
432
+
433
+ <dt>prompt <span class="property-type">string</span></dt>
434
+ <dt class="optional">mask <span class="property-type">string</span></dt>
435
+ <dt class="optional">model <span class="property-type"></span></dt>
436
+ <dt class="optional">n <span class="property-type">integer</span></dt>
437
+ <dt class="optional">size <span class="property-type">string</span></dt>
438
+ <dt class="optional">response_format <span class="property-type">string</span></dt>
439
+ <dt class="optional">user <span class="property-type">string</span></dt>
440
+ </dl>
441
+
442
+ <h2>Create Image Variation</h2>
443
+ <p>Creates a variation of a given image.</p>
444
+ <dl class="message-properties">
445
+ <h2>msg.payload Properties</h2>
446
+
447
+ <dt>image <span class="property-type">string</span></dt>
448
+
449
+ <dt>model <span class="property-type"></span></dt>
450
+ <dt>n <span class="property-type">integer</span></dt>
451
+ <dt>response_format <span class="property-type">string</span></dt>
452
+ <dt>size <span class="property-type">string</span></dt>
453
+ <dt>user <span class="property-type">string</span></dt>
454
+ </dl>
455
+ </section>
456
+
457
+ <section>
458
+ <h1 style="font-weight: bold;">๐Ÿ“Ÿ Messages</h1>
459
+ <a href="https://platform.openai.com/docs/api-reference/messages" target="_blank">Official Documentation</a>
460
+ <h2>List Messages</h2>
461
+ <p>Returns a list of messages for a given thread.</p>
462
+ <dl class="message-properties">
463
+ <h2>msg.payload Properties</h2>
464
+
465
+ <dt>thread_id <span class="property-type">string</span></dt>
466
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
467
+ <dt class="optional">order <span class="property-type">string</span></dt>
468
+ <dt class="optional">after <span class="property-type">string</span></dt>
469
+ <dt class="optional">before <span class="property-type">string</span></dt>
470
+ </dl>
471
+
472
+ <h3>Create Message</h3>
473
+ <p>Create a message.</p>
474
+ <dl class="message-properties">
475
+ <h2>msg.payload Properties</h2>
476
+
477
+ <dt>thread_id <span class="property-type">string</span></dt>
478
+
479
+ <dt>role <span class="property-type">string</span></dt>
480
+ <dt>content <span class="property-type">string</span></dt>
481
+ <dt class="optional">file_ids <span class="property-type">array</span></dt>
482
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
483
+ </dl>
484
+
485
+ <h3>Retrieve Message</h3>
486
+ <p>Retrieve a message.</p>
487
+ <dl class="message-properties">
488
+ <h2>msg.payload Properties</h2>
489
+
490
+ <dt>thread_id <span class="property-type">string</span></dt>
491
+ <dt>message_id <span class="property-type">string</span></dt>
492
+ </dl>
493
+
494
+ <h3>Modify Message</h3>
495
+ <p>Modifies a message.</p>
496
+ <dl class="message-properties">
497
+ <h2>msg.payload Properties</h2>
498
+
499
+ <dt>thread_id <span class="property-type">string</span></dt>
500
+ <dt>message_id <span class="property-type">string</span></dt>
501
+
502
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
503
+ </dl>
504
+
505
+ <h3>List Message Files</h3>
506
+ <p>Returns a list of message files.</p>
507
+ <dl class="message-properties">
508
+ <h2>msg.payload Properties</h2>
509
+
510
+ <dt>thread_id <span class="property-type">string</span></dt>
511
+ <dt>message_id <span class="property-type">string</span></dt>
512
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
513
+ <dt class="optional">order <span class="property-type">string</span></dt>
514
+ <dt class="optional">after <span class="property-type">string</span></dt>
515
+ <dt class="optional">before <span class="property-type">string</span></dt>
516
+ </dl>
517
+
518
+ <h3>Retrieve Message File</h3>
519
+ <p>Retrieves a message file.</p>
520
+ <dl class="message-properties">
521
+ <h2>msg.payload Properties</h2>
522
+
523
+ <dt>thread_id <span class="property-type">string</span></dt>
524
+ <dt>message_id <span class="property-type">string</span></dt>
525
+ <dt>file_id <span class="property-type">string</span></dt>
526
+ </dl>
527
+ </section>
528
+
529
+ <section>
530
+ <h1 style="font-weight: bold;">๐Ÿง  Models</h1>
531
+ <a href="https://platform.openai.com/docs/api-reference/models" target="_blank">Official Documentation</a>
532
+ <h2>List Models</h2>
533
+ <p>Lists the currently available models, and provides basic information about each one such as the owner and availability.</p>
534
+ <dl class="message-properties"></dl>
535
+
536
+ <h2>Retrieve Model</h2>
537
+ <p>Retrieves a model instance, providing basic information about the model such as the owner and permissioning.</p>
538
+ <dl class="message-properties">
539
+ <h2>msg.payload Properties</h2>
540
+
541
+ <dt>model <span class="property-type">string</span></dt>
542
+ </dl>
543
+
544
+ <h2>Delete Fine-tun Model</h2>
545
+ <p>Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.</p>
546
+ <dl class="message-properties">
547
+ <h2>msg.payload Properties</h2>
548
+
549
+ <dt>model <span class="property-type">string</span></dt>
550
+ </dl>
551
+
552
+ <section>
553
+ <h1 style="font-weight: bold;">โœ… Moderations</h1>
554
+ <a href="https://platform.openai.com/docs/api-reference/moderations" target="_blank">Official Documentation</a>
555
+ <h2>Create Moderation</h2>
556
+ <p>Classifies if text violates OpenAI's Content Policy</p>
557
+ <dl class="message-properties">
558
+ <h2>msg.payload Properties</h2>
559
+
560
+ <dt>input <span class="property-type"></span></dt>
561
+ <dt class="optional">model <span class="property-type"></span></dt>
562
+ </dl>
563
+ </section>
564
+
565
+ <section>
566
+ <h1 style="font-weight: bold;">๐Ÿ”„ Runs</h1>
567
+ <a href="https://platform.openai.com/docs/api-reference/runs" target="_blank">Official Documentation</a>
568
+ <h2>Create Thread and Run</h2>
569
+ <p>Create a thread and run it in one request.</p>
570
+ <dl class="message-properties">
571
+ <h2>msg.payload Properties</h2>
572
+
573
+ <dt>assistant_id <span class="property-type"></span></dt>
574
+ <dt class="optional">thread <span class="property-type">object</span></dt>
575
+ <dt class="optional">model <span class="property-type">string</span></dt>
576
+ <dt class="optional">instructions <span class="property-type">string</span></dt>
577
+ <dt class="optional">tools <span class="property-type">array</span></dt>
578
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
579
+ </dl>
580
+
581
+ <h2>List Runs</h2>
582
+ <p>Returns a list of runs belonging to a thread.</p>
583
+ <dl class="message-properties">
584
+ <h2>msg.payload Properties</h2>
585
+
586
+ <dt>thread_id <span class="property-type">string</span></dt>
587
+
588
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
589
+ <dt class="optional">order <span class="property-type">string</span></dt>
590
+ <dt class="optional">after <span class="property-type">string</span></dt>
591
+ <dt class="optional">before <span class="property-type">string</span></dt>
592
+ </dl>
593
+
594
+ <h2>Create Run</h2>
595
+ <p>Create a run.</p>
596
+ <dl class="message-properties">
597
+ <h2>msg.payload Properties</h2>
598
+
599
+ <dt>thread_id <span class="property-type">string</span></dt>
600
+
601
+ <dt>assistant_id <span class="property-type">string</span></dt>
602
+ <dt class="optional">model <span class="property-type">string</span></dt>
603
+ <dt class="optional">instructions <span class="property-type">string</span></dt>
604
+ <dt class="optional">tools <span class="property-type"></span>array</dt>
605
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
606
+ </dl>
607
+
608
+ <h2>Retrieve Run</h2>
609
+ <p>Retrieves a run.</p>
610
+ <dl class="message-properties">
611
+ <h2>msg.payload Properties</h2>
612
+
613
+ <dt>thread_id <span class="property-type">string</span></dt>
614
+ <dt>run_id <span class="property-type">string</span></dt>
615
+ </dl>
616
+
617
+ <h2>Modify Run</h2>
618
+ <p>Modifies a run.</p>
619
+ <dl class="message-properties">
620
+ <h2>msg.payload Properties</h2>
621
+
622
+ <dt>thread_id <span class="property-type">string</span></dt>
623
+ <dt>run_id <span class="property-type">string</span></dt>
624
+
625
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
626
+ </dl>
627
+
628
+ <h2>Submit Tool Outputs to Run</h2>
629
+ <p>When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request.</p>
630
+ <dl class="message-properties">
631
+ <h2>msg.payload Properties</h2>
632
+
633
+ <dt>thread_id <span class="property-type">string</span></dt>
634
+ <dt>run_id <span class="property-type">string</span></dt>
635
+
636
+ <dt>tool_outputs <span class="property-type">array</span></dt>
637
+ </dl>
638
+
639
+ <h2>Cancel Run</h2>
640
+ <p>Cancels a run that is `in_progress`.</p>
641
+ <dl class="message-properties">
642
+ <h2>msg.payload Properties</h2>
643
+
644
+ <dt>thread_id <span class="property-type">string</span></dt>
645
+ <dt>run_id <span class="property-type">string</span></dt>
646
+ </dl>
647
+
648
+ <h2>List Run Steps</h2>
649
+ <p>Returns a list of run steps belonging to a run.</p>
650
+ <dl class="message-properties">
651
+ <h2>msg.payload Properties</h2>
652
+
653
+ <dt>thread_id <span class="property-type">string</span></dt>
654
+ <dt>run_id <span class="property-type">string</span></dt>
655
+ <dt class="optional">limit <span class="property-type">integer</span></dt>
656
+ <dt class="optional">order <span class="property-type">string</span></dt>
657
+ <dt class="optional">after <span class="property-type">string</span></dt>
658
+ <dt class="optional">before <span class="property-type">string</span></dt>
659
+ </dl>
660
+
661
+ <h2>Retrieve Run Step</h2>
662
+ <p>Retrieves a run step.</p>
663
+ <dl class="message-properties">
664
+ <h2>msg.payload Properties</h2>
665
+
666
+ <dt>thread_id <span class="property-type">string</span></dt>
667
+ <dt>run_id <span class="property-type">string</span></dt>
668
+ <dt>step_id <span class="property-type">string</span></dt>
669
+ </dl>
670
+ </section>
671
+
672
+ <section>
673
+ <h1 style="font-weight: bold;">๐Ÿงต Threads</h1>
674
+ <a href="https://platform.openai.com/docs/api-reference/threads" target="_blank">Official Documentation</a>
675
+ <h2>Create Thread</h2>
676
+ <p>Create a thread.</p>
677
+ <dl class="message-properties">
678
+ <h2>msg.payload Properties</h2>
679
+
680
+ <dt class="optional">messages <span class="property-type">array</span></dt>
681
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
682
+ </dl>
683
+
684
+ <h2>Retrieve Thread</h2>
685
+ <p>Retrieves a thread.</p>
686
+ <dl class="message-properties">
687
+ <h2>msg.payload Properties</h2>
688
+
689
+ <dt>thread_id <span class="property-type">string</span></dt>
690
+ </dl>
691
+
692
+ <h2>Modify Thread</h2>
693
+ <p>Modifies a thread.</p>
694
+ <dl class="message-properties">
695
+ <h2>msg.payload Properties</h2>
696
+
697
+ <dt>thread_id <span class="property-type">string</span></dt>
698
+
699
+ <dt class="optional">metadata <span class="property-type">object</span></dt>
700
+ </dl>
701
+
702
+ <h2>Delete Thread</h2>
703
+ <p>Delete a thread.</p>
704
+ <dl class="message-properties">
705
+ <h2>msg.payload Properties</h2>
706
+
707
+ <dt>thread_id <span class="property-type">string</span></dt>
708
+ </dl>
709
+ </section>
710
+ </script>
711
+
712
+ <script type="text/javascript">
713
+ RED.nodes.registerType('openai-api-service', {
714
+ category: 'config',
715
+ defaults: {
716
+
717
+ secureApiKeyHeaderOrQueryName: { value: "Authorization" },
718
+ secureApiKeyIsQuery: { value: false },
719
+
720
+ name: { value: "" },
721
+ },
722
+ credentials: {
723
+ secureApiKeyValue: { type: "password" },
724
+ temp: { type: "text" }
725
+ },
726
+ label: function () {
727
+ return this.name || this.host;
728
+ },
729
+ labelStyle: function () {
730
+ return this.name ? "node_label_italic" : "";
731
+ },
732
+ oneditprepare: function () {
733
+ $('#node-config-input-secureApiKeyIsQuery-label').hide();
734
+ $('#node-config-input-secureApiKeyIsQuery').hide();
735
+ var selected = $('#node-config-input-secureApiKeyIsQuery option:selected');
736
+ if (!selected.val()) {
737
+ $('#node-config-input-secureApiKeyIsQuery').val(false);
738
+ }
739
+ }
740
+ });
741
+ </script>
742
+
743
+ <script type="text/html" data-template-name="openai-api-service">
744
+
745
+ <div class="form-row">
746
+ <label id="node-config-input-secureApiKeyHeaderOrQueryName-label" for="node-config-input-secureApiKeyHeaderOrQueryName"><i class="fa fa-list"></i> <span data-i18n="OpenaiApi.label.header"></span></label>
747
+ <input type="text" id="node-config-input-secureApiKeyHeaderOrQueryName" placeholder="">
748
+ </div>
749
+ <div class="form-row">
750
+ <label id="node-config-input-secureApiKeyValue-label" for="node-config-input-secureApiKeyValue"><i class="fa fa-lock"></i> <span data-i18n="OpenaiApi.label.value"></span></label>
751
+ <input type="password" id="node-config-input-secureApiKeyValue" placeholder="">
752
+ </div>
753
+ <div class="form-row">
754
+ <label id="node-config-input-secureApiKeyIsQuery-label" for="node-config-input-secureApiKeyIsQuery"><i class="fa fa-dot-circle-o"></i> <span data-i18n="OpenaiApi.label.isQuery"></span></label>
755
+ <select id="node-config-input-secureApiKeyIsQuery">
756
+ <option value="true">true</option>
757
+ <option value="false">false</option>
758
+ </select>
759
+ </div>
760
+
761
+ <div class="form-row">
762
+ <label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
763
+ <input type="text" id="node-config-input-name" data-i18n="[placeholder]node-red:common.label.name">
764
+ </div>
765
+ </script>
766
+
767
+ <script type="text/html" data-help-name="openai-api-service">
768
+
769
+ <p><b>Header</b>: Variable name to set API key</p>
770
+ <p><b>Value</b>: Value of API key</p>
771
+ </script>