@inductiv/node-red-openai-api 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -40,10 +40,11 @@ After installation, find your node in the **AI** palette category labeled "OpenA
40
40
  - **Configurable and Flexible**: Adapt to a wide range of project requirements, making it easy to integrate AI into your IoT solutions.
41
41
  - **Powerful Combinations**: Utilize Node-RED's diverse nodes to build complex, AI-driven IoT workflows with ease.
42
42
 
43
- ## Release Notes (v1.5.0)
43
+ ## Release Notes (v1.7.0)
44
44
 
45
- - Upgraded to OpenAI Node API Library package dependency v4.68.0
46
- - Supporting OpenAI's new [chat completion audio generation](https://platform.openai.com/docs/guides/audio) functionality with **gpt-4o-audio-preview** model capabilities
45
+ - Upgraded to OpenAI Node API Library package dependency [v4.77.0](https://www.npmjs.com/package/openai/v/4.77.0)
46
+ - OpenAI [o1 and new tools](https://openai.com/index/o1-and-new-tools-for-developers/) for developers
47
+ - [Preference Fine-tuning](https://platform.openai.com/docs/guides/fine-tuning#preference)
47
48
 
48
49
  ## What's New in Version 1.x
49
50
 
@@ -64,6 +65,32 @@ Version 1.0 of the **node-red-openai-api** node brings significant enhancements
64
65
 
65
66
  I recommend reviewing existing flows and testing them with this new version in a development environment before updating to ensure a smooth transition. This will help you take full advantage of the enhanced features while managing any necessary adjustments in your existing applications.
66
67
 
68
+ ## OpenAI API Compatible Servers
69
+
70
+ Node-RED OpenAI API Works with your favorite OpenAI API compatible servers, including:
71
+
72
+ - [Baseten](https://www.baseten.co/)
73
+ - [Cloudflare Workers AI](https://developers.cloudflare.com/workers-ai/)
74
+ - [gpt4all](https://github.com/nomic-ai/gpt4all)
75
+ - [Google AI Studio](https://ai.google.dev/gemini-api/docs/openai#node.js)
76
+ - [Groq](https://groq.com/)
77
+ - [Hugging Face Inference API](https://huggingface.co/docs/api-inference/tasks/chat-completion)
78
+ - [Jan](https://jan.ai/)
79
+ - [Lightning AI](https://lightning.ai/)
80
+ - [LiteLLM](https://www.litellm.ai/)
81
+ - [llama.cpp](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file)
82
+ - [llamafile](https://github.com/Mozilla-Ocho/llamafile)
83
+ - [LlamaIndex](https://www.llamaindex.ai/)
84
+ - [LM Studio](https://lmstudio.ai/)
85
+ - [LMDeploy](https://github.com/InternLM/lmdeploy)
86
+ - [LocalAI](https://localai.io/)
87
+ - [Mistral AI](https://mistral.ai/)
88
+ - [Ollama](https://ollama.com/)
89
+ - [OpenRouter](https://openrouter.ai/)
90
+ - [Titan ML](https://www.titanml.co/)
91
+ - [Vllm](https://docs.vllm.ai/en/v0.6.0/index.html)
92
+ - and many more...
93
+
67
94
  ## Contribute
68
95
 
69
96
  I value community contributions that help enhance this Node-RED node and expand its capabilities in AIoT applications. Whether you're fixing bugs, adding new features, or improving documentation, your help is welcome!
package/lib.js CHANGED
@@ -1,3 +1,6 @@
1
+ const { response } = require("express");
2
+ const { json } = require("stream/consumers");
3
+
1
4
  let OpenaiApi = (function () {
2
5
  "use strict";
3
6
 
@@ -19,7 +22,7 @@ let OpenaiApi = (function () {
19
22
  const { vector_store_id, ...params } = parameters.payload;
20
23
  const response = await openai.beta.vectorStores.files.create(
21
24
  vector_store_id,
22
- params,
25
+ params
23
26
  );
24
27
 
25
28
  return response;
@@ -32,7 +35,7 @@ let OpenaiApi = (function () {
32
35
  const { vector_store_id, ...params } = parameters.payload;
33
36
  const list = await openai.beta.vectorStores.files.list(
34
37
  vector_store_id,
35
- params,
38
+ params
36
39
  );
37
40
 
38
41
  return [...list.data];
@@ -45,7 +48,7 @@ let OpenaiApi = (function () {
45
48
  const { vector_store_id, file_id } = parameters.payload;
46
49
  const response = openai.beta.vectorStores.files.retrieve(
47
50
  vector_store_id,
48
- file_id,
51
+ file_id
49
52
  );
50
53
 
51
54
  return response;
@@ -59,7 +62,7 @@ let OpenaiApi = (function () {
59
62
  const response = openai.beta.vectorStores.files.del(
60
63
  vector_store_id,
61
64
  file_id,
62
- params,
65
+ params
63
66
  );
64
67
 
65
68
  return response;
@@ -74,7 +77,7 @@ let OpenaiApi = (function () {
74
77
  const { vector_store_id, ...params } = parameters.payload;
75
78
  const response = await openai.beta.vectorStores.fileBatches.create(
76
79
  vector_store_id,
77
- params,
80
+ params
78
81
  );
79
82
 
80
83
  return response;
@@ -86,7 +89,7 @@ let OpenaiApi = (function () {
86
89
  const response = await openai.beta.vectorStores.fileBatches.retrieve(
87
90
  vector_store_id,
88
91
  batch_id,
89
- params,
92
+ params
90
93
  );
91
94
 
92
95
  return response;
@@ -98,7 +101,7 @@ let OpenaiApi = (function () {
98
101
  const response = await openai.beta.vectorStores.fileBatches.retrieve(
99
102
  vector_store_id,
100
103
  batch_id,
101
- params,
104
+ params
102
105
  );
103
106
 
104
107
  return response;
@@ -110,7 +113,7 @@ let OpenaiApi = (function () {
110
113
  const list = await openai.beta.vectorStores.fileBatches.listFiles(
111
114
  vector_store_id,
112
115
  batch_id,
113
- params,
116
+ params
114
117
  );
115
118
  const batchFiles = [...list.data];
116
119
 
@@ -138,7 +141,7 @@ let OpenaiApi = (function () {
138
141
  const response = await openai.beta.vectorStores.fileBatches.uploadAndPoll(
139
142
  vector_store_id,
140
143
  { files: fileStreams, fileIds: file_ids },
141
- params,
144
+ params
142
145
  );
143
146
 
144
147
  return response;
@@ -149,7 +152,7 @@ let OpenaiApi = (function () {
149
152
  async createVectorStore(parameters) {
150
153
  const openai = new OpenAI(this.clientParams);
151
154
  const response = await openai.beta.vectorStores.create(
152
- parameters.payload,
155
+ parameters.payload
153
156
  );
154
157
 
155
158
  return response;
@@ -168,7 +171,7 @@ let OpenaiApi = (function () {
168
171
  const { vector_store_id, ...params } = parameters.payload;
169
172
  const response = await openai.beta.vectorStores.retrieve(
170
173
  vector_store_id,
171
- params,
174
+ params
172
175
  );
173
176
 
174
177
  return response;
@@ -179,7 +182,7 @@ let OpenaiApi = (function () {
179
182
  const { vector_store_id, ...params } = parameters.payload;
180
183
  const response = await openai.beta.vectorStores.update(
181
184
  vector_store_id,
182
- params,
185
+ params
183
186
  );
184
187
 
185
188
  return response;
@@ -190,7 +193,7 @@ let OpenaiApi = (function () {
190
193
  const { vector_store_id, ...params } = parameters.payload;
191
194
  const response = await openai.beta.vectorStores.del(
192
195
  vector_store_id,
193
- params,
196
+ params
194
197
  );
195
198
 
196
199
  return response;
@@ -378,7 +381,7 @@ let OpenaiApi = (function () {
378
381
  const { fine_tuning_job_id, ...params } = parameters.payload;
379
382
  const response = await openai.fineTuning.jobs.retrieve(
380
383
  fine_tuning_job_id,
381
- params,
384
+ params
382
385
  );
383
386
 
384
387
  return response;
@@ -389,7 +392,7 @@ let OpenaiApi = (function () {
389
392
  const { fine_tuning_job_id, ...params } = parameters.payload;
390
393
  const list = await openai.fineTuning.jobs.listEvents(
391
394
  fine_tuning_job_id,
392
- params,
395
+ params
393
396
  );
394
397
 
395
398
  return [...list.data];
@@ -400,7 +403,7 @@ let OpenaiApi = (function () {
400
403
  const { fine_tuning_job_id, ...params } = parameters.payload;
401
404
  const list = await openai.fineTuning.jobs.checkpoints.list(
402
405
  fine_tuning_job_id,
403
- params,
406
+ params
404
407
  );
405
408
 
406
409
  return [...list.data];
@@ -411,7 +414,7 @@ let OpenaiApi = (function () {
411
414
  const { fine_tuning_job_id, ...params } = parameters.payload;
412
415
  const response = await openai.fineTuning.jobs.cancel(
413
416
  fine_tuning_job_id,
414
- params,
417
+ params
415
418
  );
416
419
 
417
420
  return response;
@@ -465,7 +468,7 @@ let OpenaiApi = (function () {
465
468
  const { assistant_id, ...params } = parameters.payload;
466
469
  const response = await openai.beta.assistants.retrieve(
467
470
  assistant_id,
468
- params,
471
+ params
469
472
  );
470
473
 
471
474
  return response;
@@ -476,7 +479,7 @@ let OpenaiApi = (function () {
476
479
  const { assistant_id, ...params } = parameters.payload;
477
480
  const response = await openai.beta.assistants.update(
478
481
  assistant_id,
479
- params,
482
+ params
480
483
  );
481
484
 
482
485
  return response;
@@ -534,7 +537,7 @@ let OpenaiApi = (function () {
534
537
  const { thread_id, ...params } = parameters.payload;
535
538
  const response = await openai.beta.threads.messages.create(
536
539
  thread_id,
537
- params,
540
+ params
538
541
  );
539
542
 
540
543
  return response;
@@ -546,7 +549,7 @@ let OpenaiApi = (function () {
546
549
  const response = await openai.beta.threads.messages.retrieve(
547
550
  thread_id,
548
551
  message_id,
549
- params,
552
+ params
550
553
  );
551
554
 
552
555
  return response;
@@ -558,11 +561,126 @@ let OpenaiApi = (function () {
558
561
  const response = await openai.beta.threads.messages.update(
559
562
  thread_id,
560
563
  message_id,
561
- params,
564
+ params
565
+ );
566
+
567
+ return response;
568
+ }
569
+
570
+ /* Begin Uploads */
571
+ async createUpload(parameters) {
572
+ const openai = new OpenAI(this.clientParams);
573
+
574
+ // Define required parameters
575
+ const required_params = ["filename", "purpose", "bytes", "mime_type"];
576
+
577
+ // Validate that all required parameters are present
578
+ const missing_params = required_params.filter(
579
+ (param) => !parameters.payload?.[param]
580
+ );
581
+ if (missing_params.length > 0) {
582
+ throw new Error(
583
+ `Missing required parameter(s): ${missing_params.join(", ")}`
584
+ );
585
+ }
586
+
587
+ // Destructure and assign the payload to match SDK expectations
588
+ const { filename, purpose, bytes, mime_type, ...optionalParams } =
589
+ parameters.payload;
590
+
591
+ const response = await openai.uploads.create(
592
+ {
593
+ filename,
594
+ purpose,
595
+ bytes,
596
+ mime_type,
597
+ },
598
+ { ...optionalParams }
599
+ );
600
+
601
+ return response;
602
+ }
603
+
604
+ async addUploadPart(parameters) {
605
+ const clientParams = {
606
+ ...this.clientParams,
607
+ };
608
+
609
+ const openai = new OpenAI(clientParams);
610
+
611
+ // Validate required parameters
612
+ const required_params = ["upload_id", "data"];
613
+ const missing_params = required_params.filter(
614
+ (param) => !parameters.payload?.[param]
615
+ );
616
+ if (missing_params.length > 0) {
617
+ throw new Error(
618
+ `Missing required parameter(s): ${missing_params.join(", ")}`
619
+ );
620
+ }
621
+
622
+ const { upload_id, data, ...optionalParams } = parameters.payload;
623
+ const response = await openai.uploads.parts.create(upload_id, data, {
624
+ ...optionalParams,
625
+ });
626
+
627
+ return response;
628
+ }
629
+
630
+ async completeUpload(parameters) {
631
+ const clientParams = {
632
+ ...this.clientParams,
633
+ };
634
+
635
+ const openai = new OpenAI(clientParams);
636
+
637
+ // Validate required parameters
638
+ const required_params = ["upload_id", "part_ids"];
639
+ const missing_params = required_params.filter(
640
+ (param) => !parameters.payload?.[param]
641
+ );
642
+ if (missing_params.length > 0) {
643
+ throw new Error(
644
+ `Missing required parameter(s): ${missing_params.join(", ")}`
645
+ );
646
+ }
647
+
648
+ const { upload_id, part_ids, ...optionalParams } = parameters.payload;
649
+ const response = await openai.uploads.complete(
650
+ upload_id,
651
+ { part_ids },
652
+ { ...optionalParams }
653
+ );
654
+
655
+ return response;
656
+ }
657
+
658
+ async cancelUpload(parameters) {
659
+ const clientParams = {
660
+ ...this.clientParams,
661
+ };
662
+
663
+ const openai = new OpenAI(clientParams);
664
+
665
+ // Validate required parameters
666
+ const required_params = ["upload_id"];
667
+ const missing_params = required_params.filter(
668
+ (param) => !parameters.payload?.[param]
562
669
  );
670
+ if (missing_params.length > 0) {
671
+ throw new Error(
672
+ `Missing required parameter(s): ${missing_params.join(", ")}`
673
+ );
674
+ }
675
+
676
+ const { upload_id, ...optionalParams } = parameters.payload;
677
+ const response = await openai.uploads.cancel(upload_id, {
678
+ ...optionalParams,
679
+ });
563
680
 
564
681
  return response;
565
682
  }
683
+ /* End Uploads */
566
684
 
567
685
  async createThreadAndRun(parameters) {
568
686
  const openai = new OpenAI(this.clientParams);
@@ -625,7 +743,7 @@ let OpenaiApi = (function () {
625
743
  const response = await openai.beta.threads.runs.retrieve(
626
744
  thread_id,
627
745
  run_id,
628
- params,
746
+ params
629
747
  );
630
748
 
631
749
  return response;
@@ -637,7 +755,7 @@ let OpenaiApi = (function () {
637
755
  const response = await openai.beta.threads.runs.update(
638
756
  thread_id,
639
757
  run_id,
640
- params,
758
+ params
641
759
  );
642
760
 
643
761
  return response;
@@ -650,7 +768,7 @@ let OpenaiApi = (function () {
650
768
  const response = await openai.beta.threads.runs.submitToolOutputs(
651
769
  thread_id,
652
770
  run_id,
653
- params,
771
+ params
654
772
  );
655
773
 
656
774
  if (params.stream) {
@@ -677,7 +795,7 @@ let OpenaiApi = (function () {
677
795
  const response = await openai.beta.threads.runs.cancel(
678
796
  thread_id,
679
797
  run_id,
680
- params,
798
+ params
681
799
  );
682
800
 
683
801
  return response;
@@ -689,7 +807,7 @@ let OpenaiApi = (function () {
689
807
  const list = await openai.beta.threads.runs.steps.list(
690
808
  thread_id,
691
809
  run_id,
692
- params,
810
+ params
693
811
  );
694
812
 
695
813
  return [...list.data];
@@ -702,7 +820,7 @@ let OpenaiApi = (function () {
702
820
  thread_id,
703
821
  run_id,
704
822
  step_id,
705
- params,
823
+ params
706
824
  );
707
825
 
708
826
  return response;
@@ -112,6 +112,10 @@
112
112
  "getMessage": "retrieve message",
113
113
  "message_id": "message id",
114
114
  "modifyMessage": "modify message",
115
+ "createUpload": "create upload",
116
+ "addUploadPart": "add upload part",
117
+ "completeUpload": "complete upload",
118
+ "cancelUpload": "cancel upload",
115
119
  "createThreadAndRun": "create thread and run",
116
120
  "listRuns": "list runs",
117
121
  "createRun": "create run",
@@ -112,6 +112,10 @@
112
112
  "getMessage": "retrieve message",
113
113
  "message_id": "message id",
114
114
  "modifyMessage": "modify message",
115
+ "createUpload": "create upload",
116
+ "addUploadPart": "add upload part",
117
+ "completeUpload": "complete upload",
118
+ "cancelUpload": "cancel upload",
115
119
  "createThreadAndRun": "create thread and run",
116
120
  "listRuns": "list runs",
117
121
  "createRun": "create run",
@@ -112,6 +112,10 @@
112
112
  "getMessage": "retrieve message",
113
113
  "message_id": "message id",
114
114
  "modifyMessage": "modify message",
115
+ "createUpload": "create upload",
116
+ "addUploadPart": "add upload part",
117
+ "completeUpload": "complete upload",
118
+ "cancelUpload": "cancel upload",
115
119
  "createThreadAndRun": "create thread and run",
116
120
  "listRuns": "list runs",
117
121
  "createRun": "create run",
@@ -112,6 +112,10 @@
112
112
  "getMessage": "retrieve message",
113
113
  "message_id": "message id",
114
114
  "modifyMessage": "modify message",
115
+ "createSession": "create session",
116
+ "createUpload": "create upload",
117
+ "addUploadPart": "add upload part",
118
+ "cancelUpload": "cancel upload",
115
119
  "createThreadAndRun": "create thread and run",
116
120
  "listRuns": "list runs",
117
121
  "createRun": "create run",
package/node.html CHANGED
@@ -265,6 +265,7 @@
265
265
  data-i18n="OpenaiApi.parameters.createModeration"
266
266
  ></option>
267
267
  </optgroup>
268
+
268
269
  <optgroup style="font-style: normal;" label="🔄 Runs (Beta)">
269
270
  <option
270
271
  value="createThreadAndRun"
@@ -300,6 +301,7 @@
300
301
  data-i18n="OpenaiApi.parameters.getRunStep"
301
302
  ></option>
302
303
  </optgroup>
304
+
303
305
  <optgroup style="font-style: normal;" label="🧵 Threads (Beta)">
304
306
  <option
305
307
  value="createThread"
@@ -319,6 +321,28 @@
319
321
  ></option>
320
322
  </optgroup>
321
323
 
324
+ <optgroup style="font-style: normal;" label="☁️ Uploads">
325
+ <option
326
+ value="createUpload"
327
+ data-i18n="OpenaiApi.parameters.createUpload"
328
+ ></option>
329
+
330
+ <option
331
+ value="addUploadPart"
332
+ data-i18n="OpenaiApi.parameters.addUploadPart"
333
+ ></option>
334
+
335
+ <option
336
+ value="completeUpload"
337
+ data-i18n="OpenaiApi.parameters.completeUpload"
338
+ ></option>
339
+
340
+ <option
341
+ value="cancelUpload"
342
+ data-i18n="OpenaiApi.parameters.cancelUpload"
343
+ ></option>
344
+ </optgroup>
345
+
322
346
  <optgroup style="font-style: normal;" label="🔢 Vector Stores (Beta)">
323
347
  <option
324
348
  value="createVectorStore"
@@ -1260,6 +1284,40 @@
1260
1284
  <span class="property-type">string</span>
1261
1285
  </dt>
1262
1286
  <dd>ID of the model to use.</dd>
1287
+
1288
+ <dt class="optional">
1289
+ store
1290
+ <a
1291
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-store"
1292
+ target="_blank"
1293
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1294
+ ></a>
1295
+ <span class="property-type">boolean | null</span>
1296
+ </dt>
1297
+ <dd>Whether to store the output of this chat completion request.</dd>
1298
+
1299
+ <dt class="optional">
1300
+ reasoning_effort
1301
+ <a
1302
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-reasoning_effort"
1303
+ target="_blank"
1304
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1305
+ ></a>
1306
+ <span class="property-type">string</span>
1307
+ </dt>
1308
+ <dd>Constrains effort on reasoning for reasoning models.</dd>
1309
+
1310
+ <dt class="optional">
1311
+ metadata
1312
+ <a
1313
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-metadata"
1314
+ target="_blank"
1315
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1316
+ ></a>
1317
+ <span class="property-type">object or null</span>
1318
+ </dt>
1319
+ <dd>Developer-defined tags and values used for filtering completions in the dashboard.</dd>
1320
+
1263
1321
  <dt class="optional">
1264
1322
  frequency_penalty
1265
1323
  <a
@@ -1331,6 +1389,46 @@
1331
1389
  <dd>
1332
1390
  How many chat completion choices to generate for each input message.
1333
1391
  </dd>
1392
+
1393
+ <dt class="optional">
1394
+ modalities
1395
+ <a
1396
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-modalities"
1397
+ target="_blank"
1398
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1399
+ ></a>
1400
+ <span class="property-type">array or null</span>
1401
+ </dt>
1402
+ <dd>
1403
+ Output types that you would like the model to generate for this request.
1404
+ </dd>
1405
+
1406
+ <dt class="optional">
1407
+ prediction
1408
+ <a
1409
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-prediction"
1410
+ target="_blank"
1411
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1412
+ ></a>
1413
+ <span class="property-type">object</span>
1414
+ </dt>
1415
+ <dd>
1416
+ Configuration for a Predicted Output.
1417
+ </dd>
1418
+
1419
+ <dt class="optional">
1420
+ audio
1421
+ <a
1422
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-audio"
1423
+ target="_blank"
1424
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1425
+ ></a>
1426
+ <span class="property-type">object or null</span>
1427
+ </dt>
1428
+ <dd>
1429
+ Parameters for audio output.
1430
+ </dd>
1431
+
1334
1432
  <dt class="optional">
1335
1433
  presence_penalty
1336
1434
  <a
@@ -1365,6 +1463,20 @@
1365
1463
  effort to sample deterministically, such that repeated requests with the
1366
1464
  same seed and parameters should return the same result.
1367
1465
  </dd>
1466
+
1467
+ <dt class="optional">
1468
+ service_tier
1469
+ <a
1470
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-service_tier"
1471
+ target="_blank"
1472
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1473
+ ></a>
1474
+ <span class="property-type">string or null</span>
1475
+ </dt>
1476
+ <dd>
1477
+ Specifies the latency tier to use for processing the request.
1478
+ </dd>
1479
+
1368
1480
  <dt class="optional">
1369
1481
  stop
1370
1482
  <a
@@ -1442,7 +1554,19 @@
1442
1554
  ></a>
1443
1555
  <span class="property-type">string | object</span>
1444
1556
  </dt>
1445
- <dd>Controls which (if any) function is called by the model.</dd>
1557
+ <dd>Whether to enable parallel function calling during tool use.</dd>
1558
+
1559
+ <dt class="optional">
1560
+ parallel_tool_calls
1561
+ <a
1562
+ href="https://platform.openai.com/docs/api-reference/chat/create#chat-create-parallel_tool_calls"
1563
+ target="_blank"
1564
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1565
+ ></a>
1566
+ <span class="property-type">string | object</span>
1567
+ </dt>
1568
+ <dd>Whether to enable parallel function calling during tool use.</dd>
1569
+
1446
1570
  <dt class="optional">
1447
1571
  user
1448
1572
  <a
@@ -1456,6 +1580,7 @@
1456
1580
  A unique identifier representing your end-user, which can help OpenAI to
1457
1581
  monitor and detect abuse.
1458
1582
  </dd>
1583
+
1459
1584
  </dl>
1460
1585
 
1461
1586
  </details>
@@ -1562,6 +1687,39 @@
1562
1687
  <span class="property-type">string</span>
1563
1688
  </dt>
1564
1689
  <dd>Only return files with the given purpose.</dd>
1690
+
1691
+ <dt class="optional">
1692
+ limit
1693
+ <a
1694
+ href="https://platform.openai.com/docs/api-reference/files/list#files-list-limit"
1695
+ target="_blank"
1696
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1697
+ ></a>
1698
+ <span class="property-type">integer</span>
1699
+ </dt>
1700
+ <dd>A limit on the number of objects to be returned.</dd>
1701
+
1702
+ <dt class="optional">
1703
+ order
1704
+ <a
1705
+ href="https://platform.openai.com/docs/api-reference/files/list#files-list-order"
1706
+ target="_blank"
1707
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1708
+ ></a>
1709
+ <span class="property-type">string</span>
1710
+ </dt>
1711
+ <dd>Sort order by the created_at timestamp of the objects.</dd>
1712
+
1713
+ <dt class="optional">
1714
+ after
1715
+ <a
1716
+ href="https://platform.openai.com/docs/api-reference/files/list#files-list-after"
1717
+ target="_blank"
1718
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1719
+ ></a>
1720
+ <span class="property-type">string</span>
1721
+ </dt>
1722
+ <dd>A cursor for use in pagination.</dd>
1565
1723
  </dl>
1566
1724
 
1567
1725
  <h4 style="font-weight: bolder;"> ⋙ Upload File</h4>
@@ -1674,16 +1832,7 @@
1674
1832
  <span class="property-type">string</span>
1675
1833
  </dt>
1676
1834
  <dd>The ID of an uploaded file that contains training data.</dd>
1677
- <dt class="optional">
1678
- hyperparameters
1679
- <a
1680
- href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-hyperparameters"
1681
- target="_blank"
1682
- ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1683
- ></a>
1684
- <span class="property-type">object</span>
1685
- </dt>
1686
- <dd>The hyperparameters used for the fine-tuning job.</dd>
1835
+
1687
1836
  <dt class="optional">
1688
1837
  suffix
1689
1838
  <a
@@ -1697,6 +1846,7 @@
1697
1846
  A string of up to 18 characters that will be added to your fine-tuned
1698
1847
  model name.
1699
1848
  </dd>
1849
+
1700
1850
  <dt class="optional">
1701
1851
  validation_file
1702
1852
  <a
@@ -1730,6 +1880,17 @@
1730
1880
  </dt>
1731
1881
  <dd>The seed controls the reproducibility of the job.</dd>
1732
1882
 
1883
+ <dt class="optional">
1884
+ method
1885
+ <a
1886
+ href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-method"
1887
+ target="_blank"
1888
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
1889
+ ></a>
1890
+ <span class="property-type">object</span>
1891
+ </dt>
1892
+ <dd>The method used for fine-tuning.</dd>
1893
+
1733
1894
  </dl>
1734
1895
 
1735
1896
  <h4 style="font-weight: bolder;"> ⋙ List Fine-tuning Jobs</h4>
@@ -2272,15 +2433,15 @@
2272
2433
  </dt>
2273
2434
  <dd>The content of the message.</dd>
2274
2435
  <dt class="optional">
2275
- file_ids
2436
+ attachments
2276
2437
  <a
2277
- href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-file_ids"
2438
+ href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-attachments"
2278
2439
  target="_blank"
2279
2440
  ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2280
2441
  ></a>
2281
2442
  <span class="property-type">array</span>
2282
2443
  </dt>
2283
- <dd>A list of File IDs that the message should use.</dd>
2444
+ <dd>A list of files attached to the message, and the tools they should be added to.</dd>
2284
2445
  <dt class="optional">
2285
2446
  metadata
2286
2447
  <a
@@ -2293,6 +2454,33 @@
2293
2454
  <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
2294
2455
  </dl>
2295
2456
 
2457
+ <h4 style="font-weight: bolder;"> ⋙ Delete Message</h4>
2458
+ <p>Deletes a message.</p>
2459
+ <dl class="message-properties">
2460
+ <h4>msg.payload Properties</h4>
2461
+
2462
+ <dt>
2463
+ thread_id
2464
+ <a
2465
+ href="https://platform.openai.com/docs/api-reference/messages/deleteMessage#messages-deletemessage-thread_id"
2466
+ target="_blank"
2467
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2468
+ ></a>
2469
+ <span class="property-type">string</span>
2470
+ </dt>
2471
+ <dd>The ID of the thread to which this message belongs.</dd>
2472
+ <dt>
2473
+ message_id
2474
+ <a
2475
+ href="https://platform.openai.com/docs/api-reference/messages/deleteMessage#messages-deletemessage-message_id"
2476
+ target="_blank"
2477
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2478
+ ></a>
2479
+ <span class="property-type">string</span>
2480
+ </dt>
2481
+ <dd>The ID of the message to delete.</dd>
2482
+ </dl>
2483
+
2296
2484
  <h4 style="font-weight: bolder;"> ⋙ Retrieve Message</h4>
2297
2485
  <p>Retrieve a message.</p>
2298
2486
  <dl class="message-properties">
@@ -2397,7 +2585,7 @@
2397
2585
  <dd>The ID of the model to use for this request</dd>
2398
2586
  </dl>
2399
2587
 
2400
- <h4 style="font-weight: bolder;"> ⋙ Delete Fine-tun Model</h4>
2588
+ <h4 style="font-weight: bolder;"> ⋙ Delete Fine-tuned Model</h4>
2401
2589
  <p>
2402
2590
  Delete a fine-tuned model. You must have the Owner role in your
2403
2591
  organization to delete a model.
@@ -2419,6 +2607,7 @@
2419
2607
  </details>
2420
2608
  </section>
2421
2609
 
2610
+ <!-- Begin Moderations docs -->
2422
2611
  <section>
2423
2612
  <details>
2424
2613
  <summary style="font-weight: bold;">✅ Moderations</summary>
@@ -2461,6 +2650,7 @@
2461
2650
  </details>
2462
2651
  </section>
2463
2652
 
2653
+ <!-- Begin Runs docs -->
2464
2654
  <section>
2465
2655
  <details>
2466
2656
  <summary style="font-weight: bold;">🔄 Runs</summary>
@@ -2515,6 +2705,7 @@
2515
2705
  <span class="property-type">string</span>
2516
2706
  </dt>
2517
2707
  <dd>Override the default system message of the assistant.</dd>
2708
+
2518
2709
  <dt class="optional">
2519
2710
  tools
2520
2711
  <a
@@ -2525,6 +2716,19 @@
2525
2716
  <span class="property-type">array</span>
2526
2717
  </dt>
2527
2718
  <dd>Override the tools the assistant can use for this run.</dd>
2719
+
2720
+ <dt class="optional">
2721
+ tool_resources
2722
+ <a
2723
+ href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-tool_resources"
2724
+ target="_blank"
2725
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2726
+ ></a>
2727
+ <span class="property-type">object or null</span>
2728
+ </dt>
2729
+ <dd>A set of resources that are used by the assistant's tools.</dd>
2730
+
2731
+
2528
2732
  <dt class="optional">
2529
2733
  metadata
2530
2734
  <a
@@ -2536,7 +2740,6 @@
2536
2740
  </dt>
2537
2741
  <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
2538
2742
 
2539
-
2540
2743
  <dt class="optional">
2541
2744
  temperature
2542
2745
  <a
@@ -2547,6 +2750,18 @@
2547
2750
  <span class="property-type">number</span>
2548
2751
  </dt>
2549
2752
  <dd>What sampling temperature to use, between 0 and 2.</dd>
2753
+
2754
+ <dt class="optional">
2755
+ top_p
2756
+ <a
2757
+ href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-top_p"
2758
+ target="_blank"
2759
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2760
+ ></a>
2761
+ <span class="property-type">number or null</span>
2762
+ </dt>
2763
+ <dd>An alternative to sampling with temperature.</dd>
2764
+
2550
2765
 
2551
2766
  <dt class="optional">
2552
2767
  stream
@@ -2608,6 +2823,17 @@
2608
2823
  </dt>
2609
2824
  <dd>Controls which (if any) tool is called by the model. <code>none</code> means the model will not call any tools and instead generates a message. <code>auto</code> is the default value and means the model can pick between generating a message or calling a tool. Specifying a particular tool like <code>{"type": "TOOL_TYPE"}</code> forces the model to call that tool.</dd>
2610
2825
 
2826
+ <dt class="optional">
2827
+ parallel_tool_calls
2828
+ <a
2829
+ href="https://platform.openai.com/docs/api-reference/runs/createThreadAndRun#runs-createthreadandrun-parallel_tool_calls"
2830
+ target="_blank"
2831
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2832
+ ></a>
2833
+ <span class="property-type">boolean</span>
2834
+ </dt>
2835
+ <dd>Whether to enable parallel function calling during tool use.</dd>
2836
+
2611
2837
  <dt class="optional">
2612
2838
  response_format
2613
2839
  <a
@@ -2693,6 +2919,18 @@
2693
2919
  <span class="property-type">string</span>
2694
2920
  </dt>
2695
2921
  <dd>The ID of the thread to run.</dd>
2922
+
2923
+ <dt>
2924
+ include
2925
+ <a
2926
+ href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-include"
2927
+ target="_blank"
2928
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
2929
+ ></a>
2930
+ <span class="property-type">array</span>
2931
+ </dt>
2932
+ <dd>A list of additional fields to include in the response.</dd>
2933
+
2696
2934
  <dt>
2697
2935
  assistant_id
2698
2936
  <a
@@ -2850,6 +3088,17 @@
2850
3088
  </dt>
2851
3089
  <dd>Controls for how a thread will be truncated prior to the run.</dd>
2852
3090
 
3091
+ <dt class="optional">
3092
+ parallel_tool_calls
3093
+ <a
3094
+ href="https://platform.openai.com/docs/api-reference/runs/createRun#runs-createrun-parallel_tool_calls"
3095
+ target="_blank"
3096
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3097
+ ></a>
3098
+ <span class="property-type">boolean</span>
3099
+ </dt>
3100
+ <dd>Whether to enable parallel function calling during tool use.</dd>
3101
+
2853
3102
  <dt class="optional">
2854
3103
  response_format
2855
3104
  <a
@@ -2868,9 +3117,24 @@
2868
3117
  <dl class="message-properties">
2869
3118
  <h4>msg.payload Properties</h4>
2870
3119
 
2871
- <dt>thread_id <span class="property-type">string</span></dt>
3120
+ <dt>thread_id
3121
+ <a
3122
+ href="https://platform.openai.com/docs/api-reference/runs/getRun#runs-getrun-thread_id"
3123
+ target="_blank"
3124
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3125
+ ></a>
3126
+ <span class="property-type">string</span>
3127
+ </dt>
2872
3128
  <dd>The ID of the thread that was run.</dd>
2873
- <dt>run_id <span class="property-type">string</span></dt>
3129
+
3130
+ <dt>run_id
3131
+ <a
3132
+ href="https://platform.openai.com/docs/api-reference/runs/getRun#runs-getrun-run_id"
3133
+ target="_blank"
3134
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3135
+ ></a>
3136
+ <span class="property-type">string</span>
3137
+ </dt>
2874
3138
  <dd>The ID of the run to retrieve.</dd>
2875
3139
  </dl>
2876
3140
 
@@ -3048,6 +3312,7 @@
3048
3312
  <span class="property-type">string</span>
3049
3313
  </dt>
3050
3314
  <dd>A cursor for use in pagination.</dd>
3315
+
3051
3316
  <dt class="optional">
3052
3317
  before
3053
3318
  <a
@@ -3058,6 +3323,17 @@
3058
3323
  <span class="property-type">string</span>
3059
3324
  </dt>
3060
3325
  <dd>A cursor for use in pagination.</dd>
3326
+
3327
+ <dt class="optional">
3328
+ include
3329
+ <a
3330
+ href="https://platform.openai.com/docs/api-reference/run-steps/listRunSteps#run-steps-listrunsteps-include"
3331
+ target="_blank"
3332
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3333
+ ></a>
3334
+ <span class="property-type">array</span>
3335
+ </dt>
3336
+ <dd>A list of additional fields to include in the response.</dd>
3061
3337
  </dl>
3062
3338
 
3063
3339
  <h4 style="font-weight: bolder;"> ⋙ Retrieve Run Step</h4>
@@ -3085,6 +3361,7 @@
3085
3361
  <span class="property-type">string</span>
3086
3362
  </dt>
3087
3363
  <dd>The ID of the run to which the run step belongs.</dd>
3364
+
3088
3365
  <dt>
3089
3366
  step_id
3090
3367
  <a
@@ -3095,11 +3372,24 @@
3095
3372
  <span class="property-type">string</span>
3096
3373
  </dt>
3097
3374
  <dd>The ID of the run step to retrieve.</dd>
3375
+
3376
+ <dt>
3377
+ include
3378
+ <a
3379
+ href="https://platform.openai.com/docs/api-reference/run-steps/getRunStep#run-steps-getrunstep-include"
3380
+ target="_blank"
3381
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3382
+ ></a>
3383
+ <span class="property-type">array</span>
3384
+ </dt>
3385
+ <dd>A list of additional fields to include in the response.</dd>
3386
+
3098
3387
  </dl>
3099
3388
 
3100
3389
  </details>
3101
3390
  </section>
3102
3391
 
3392
+ <!-- Begin Threads docs-->
3103
3393
  <section>
3104
3394
  <details>
3105
3395
  <summary style="font-weight: bold;">🧵 Threads</summary>
@@ -3124,6 +3414,18 @@
3124
3414
  <span class="property-type">array</span>
3125
3415
  </dt>
3126
3416
  <dd>A list of messages to start the thread with.</dd>
3417
+
3418
+ <dt class="optional">
3419
+ tool_resources
3420
+ <a
3421
+ href="https://platform.openai.com/docs/api-reference/threads/createThread#threads-createthread-tool_resources"
3422
+ target="_blank"
3423
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3424
+ ></a>
3425
+ <span class="property-type">array</span>
3426
+ </dt>
3427
+ <dd>A set of resources that are made available to the assistant's tools in this thread.</dd>
3428
+
3127
3429
  <dt class="optional">
3128
3430
  metadata
3129
3431
  <a
@@ -3202,6 +3504,158 @@
3202
3504
  </details>
3203
3505
  </section>
3204
3506
 
3507
+ <!-- Begin Uploads docs -->
3508
+ <section>
3509
+ <details>
3510
+ <summary style="font-weight: bold;">☁️ Uploads</summary>
3511
+ <a
3512
+ href="https://platform.openai.com/docs/api-reference/uploads"
3513
+ target="_blank"
3514
+ >Official Documentation
3515
+ <i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3516
+ ></a>
3517
+ <h4 style="font-weight: bolder;"> ⋙ Create Upload</h4>
3518
+ <p>Creates an intermediate Upload object that you can add Parts to. </p>
3519
+ <dl class="message-properties">
3520
+ <h4>msg.payload Properties</h4>
3521
+
3522
+ <dt>
3523
+ filename
3524
+ <a
3525
+ href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-filename"
3526
+ target="_blank"
3527
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3528
+ ></a>
3529
+ <span class="property-type">string</span>
3530
+ </dt>
3531
+ <dd>The name of the file to upload.</dd>
3532
+
3533
+ <dt>
3534
+ purpose
3535
+ <a
3536
+ href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-purpose"
3537
+ target="_blank"
3538
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3539
+ ></a>
3540
+ <span class="property-type">string</span>
3541
+ </dt>
3542
+ <dd>The intended purpose of the uploaded file.</dd>
3543
+
3544
+ <dt>
3545
+ bytes
3546
+ <a
3547
+ href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-bytes"
3548
+ target="_blank"
3549
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3550
+ ></a>
3551
+ <span class="property-type">integer</span>
3552
+ </dt>
3553
+ <dd>The number of bytes in the file you are uploading.</dd>
3554
+
3555
+ <dt>
3556
+ mime_type
3557
+ <a
3558
+ href="https://platform.openai.com/docs/api-reference/uploads/create#uploads-create-mime_type"
3559
+ target="_blank"
3560
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3561
+ ></a>
3562
+ <span class="property-type">integer</span>
3563
+ </dt>
3564
+ <dd>This must fall within the supported MIME types for your file purpose.</dd>
3565
+
3566
+ </dl>
3567
+
3568
+ <h4 style="font-weight: bolder;"> ⋙ Add Upload Part</h4>
3569
+ <p>Adds a Part to an Upload object.</p>
3570
+ <dl class="message-properties">
3571
+ <h4>msg.payload Properties</h4>
3572
+
3573
+ <dt>
3574
+ upload_id
3575
+ <a
3576
+ href="https://platform.openai.com/docs/api-reference/uploads/add-part#uploads-add-part-upload_id"
3577
+ target="_blank"
3578
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3579
+ ></a>
3580
+ <span class="property-type">string</span>
3581
+ </dt>
3582
+ <dd>The ID of the Upload.</dd>
3583
+
3584
+ <dt>
3585
+ data
3586
+ <a
3587
+ href="https://platform.openai.com/docs/api-reference/uploads/add-part#uploads-add-part-data"
3588
+ target="_blank"
3589
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3590
+ ></a>
3591
+ <span class="property-type">file</span>
3592
+ </dt>
3593
+ <dd>The chunk of bytes for this Part.</dd>
3594
+
3595
+ </dl>
3596
+
3597
+ <h4 style="font-weight: bolder;"> ⋙ Complete Upload</h4>
3598
+ <p>Completes the Upload.</p>
3599
+ <dl class="message-properties">
3600
+ <h4>msg.payload Properties</h4>
3601
+
3602
+ <dt>
3603
+ upload_id
3604
+ <a
3605
+ href="https://platform.openai.com/docs/api-reference/uploads/complete#uploads-complete-upload_id"
3606
+ target="_blank"
3607
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3608
+ ></a>
3609
+ <span class="property-type">string</span>
3610
+ </dt>
3611
+ <dd>
3612
+ The ID of the Upload.
3613
+ </dd>
3614
+
3615
+ <dt>
3616
+ part_ids
3617
+ <a
3618
+ href="https://platform.openai.com/docs/api-reference/uploads/complete#uploads-complete-part_ids"
3619
+ target="_blank"
3620
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3621
+ ></a>
3622
+ <span class="property-type">array</span>
3623
+ </dt>
3624
+ <dd>The ordered list of Part IDs.</dd>
3625
+
3626
+ <dt>
3627
+ md5
3628
+ <a
3629
+ href="https://platform.openai.com/docs/api-reference/uploads/complete#uploads-complete-md5"
3630
+ target="_blank"
3631
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3632
+ ></a>
3633
+ <span class="property-type">string</span>
3634
+ </dt>
3635
+ <dd>The optional md5 checksum for the file contents.</dd>
3636
+
3637
+ </dl>
3638
+
3639
+ <h4 style="font-weight: bolder;"> ⋙ Cancel Upload</h4>
3640
+ <p>Cancels the Upload.</p>
3641
+ <dl class="message-properties">
3642
+ <h4>msg.payload Properties</h4>
3643
+
3644
+ <dt>
3645
+ upload_id
3646
+ <a
3647
+ href="https://platform.openai.com/docs/api-reference/uploads/cancel#uploads-cancel-upload_id"
3648
+ target="_blank"
3649
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3650
+ ></a>
3651
+ <span class="property-type">string</span>
3652
+ </dt>
3653
+ <dd>The ID of the Upload.</dd>
3654
+ </dl>
3655
+
3656
+ </details>
3657
+ </section>
3658
+
3205
3659
  <!-- Begin Vector Stores Documentation-->
3206
3660
  <section>
3207
3661
  <details>
@@ -3249,6 +3703,17 @@
3249
3703
  </dt>
3250
3704
  <dd>The expiration policy for a vector store.</dd>
3251
3705
 
3706
+ <dt class="optional">
3707
+ chunking_strategy
3708
+ <a
3709
+ href="https://platform.openai.com/docs/api-reference/vector-stores/create#vector-stores-create-chunking_strategy"
3710
+ target="_blank"
3711
+ ><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
3712
+ ></a>
3713
+ <span class="property-type">object</span>
3714
+ </dt>
3715
+ <dd>The chunking strategy used to chunk the file(s).</dd>
3716
+
3252
3717
  <dt class="optional">
3253
3718
  metadata
3254
3719
  <a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inductiv/node-red-openai-api",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "Enhance your Node-RED projects with advanced AI capabilities.",
5
5
  "main": "node.js",
6
6
  "engines": {
@@ -30,12 +30,7 @@
30
30
  "low-code"
31
31
  ],
32
32
  "dependencies": {
33
- "openai": "~4.68.0"
34
- },
35
- "devDependencies": {
36
- "eslint": "^9.2.0",
37
- "eslint-plugin-jest": "^28.5.0",
38
- "prettier": "^3.2.5"
33
+ "openai": "~4.77.0"
39
34
  },
40
35
  "author": "Allan Bunch",
41
36
  "license": "MIT",