@inductiv/node-red-openai-api 1.1.0 → 1.2.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 +5 -5
- package/lib.js +30 -21
- package/locales/de-DE/node.json +1 -0
- package/locales/en-US/node.json +1 -0
- package/locales/ja/node.json +1 -0
- package/locales/zh-CN/node.json +1 -0
- package/node.html +45 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Node-RED OpenAI API: Unleashing AIoT Innovation
|
|
3
3
|
<br>
|
|
4
4
|
<a href="https://github.com/allanbunch/node-red-openai-api">
|
|
5
|
-
<img width="265" alt="node-red-openai-api-node" src="https://github.com/allanbunch/node-red-openai-api/assets/4503640/
|
|
5
|
+
<img width="265" alt="node-red-openai-api-node" src="https://github.com/allanbunch/node-red-openai-api/assets/4503640/ee954c8e-fbf4-4812-a38a-f047cecd1982">
|
|
6
6
|
</a>
|
|
7
7
|
<br>
|
|
8
8
|
@inductiv/node-red-openai-api
|
|
@@ -16,13 +16,13 @@ Welcome to _@inductiv/node-red-openai-api_, a versatile and configurable Node-RE
|
|
|
16
16
|
- **Configurable and Flexible**: Adapt to a wide range of project requirements, making it easy to integrate AI into your IoT solutions.
|
|
17
17
|
- **Powerful Combinations**: Utilize Node-RED's diverse nodes to build complex, AI-driven IoT workflows with ease.
|
|
18
18
|
|
|
19
|
-
## Release Notes (v1.
|
|
19
|
+
## Release Notes (v1.2.0)
|
|
20
20
|
|
|
21
|
-
-
|
|
22
|
-
- Added the ```vectorStores.fileBatches.uploadAndPoll``` endpoint to the **Vector Store File Batches** endpoint group.
|
|
21
|
+
- Added the [```fineTuning.jobs.checkpoints.list```](https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints) endpoint to the **Fine-tuning** API.
|
|
23
22
|
- Updated the node's documentation panel.
|
|
23
|
+
- Code stability & formatting updates.
|
|
24
24
|
|
|
25
|
-
## What's New in Version 1.
|
|
25
|
+
## What's New in Version 1.x
|
|
26
26
|
|
|
27
27
|
Version 1.0 of the **node-red-openai-api** node brings significant enhancements and new possibilities, including:
|
|
28
28
|
|
package/lib.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const { response } = require("express");
|
|
2
|
-
|
|
3
1
|
let OpenaiApi = (function () {
|
|
4
2
|
"use strict";
|
|
5
3
|
|
|
@@ -121,31 +119,31 @@ let OpenaiApi = (function () {
|
|
|
121
119
|
|
|
122
120
|
async uploadAndPollVectorStoreFileBatch(parameters) {
|
|
123
121
|
const openai = new OpenAI(this.clientParams);
|
|
124
|
-
const { vector_store_id, files, file_ids, ...params } =
|
|
125
|
-
|
|
122
|
+
const { vector_store_id, files, file_ids, ...params } =
|
|
123
|
+
parameters.payload;
|
|
124
|
+
|
|
126
125
|
if (!files || !Array.isArray(files)) {
|
|
127
126
|
throw new Error("Files is not defined or not an array");
|
|
128
127
|
}
|
|
129
|
-
|
|
128
|
+
|
|
130
129
|
// Validate file paths
|
|
131
|
-
files.forEach(path => {
|
|
130
|
+
files.forEach((path) => {
|
|
132
131
|
if (!fs.existsSync(path)) {
|
|
133
132
|
throw new Error(`File does not exist: ${path}`);
|
|
134
133
|
}
|
|
135
134
|
});
|
|
136
|
-
|
|
137
|
-
const fileStreams = files.map(path => fs.createReadStream(path));
|
|
138
|
-
|
|
135
|
+
|
|
136
|
+
const fileStreams = files.map((path) => fs.createReadStream(path));
|
|
137
|
+
|
|
139
138
|
const response = await openai.beta.vectorStores.fileBatches.uploadAndPoll(
|
|
140
139
|
vector_store_id,
|
|
141
|
-
{files: fileStreams, fileIds: file_ids},
|
|
142
|
-
params
|
|
140
|
+
{ files: fileStreams, fileIds: file_ids },
|
|
141
|
+
params,
|
|
143
142
|
);
|
|
144
|
-
|
|
143
|
+
|
|
145
144
|
return response;
|
|
146
145
|
}
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
|
|
149
147
|
// <<< End File Batch Functions
|
|
150
148
|
|
|
151
149
|
async createVectorStore(parameters) {
|
|
@@ -365,9 +363,7 @@ let OpenaiApi = (function () {
|
|
|
365
363
|
|
|
366
364
|
async createFineTuningJob(parameters) {
|
|
367
365
|
const openai = new OpenAI(this.clientParams);
|
|
368
|
-
const response = await openai.fineTuning.jobs.create(
|
|
369
|
-
parameters.payload,
|
|
370
|
-
);
|
|
366
|
+
const response = await openai.fineTuning.jobs.create(parameters.payload);
|
|
371
367
|
|
|
372
368
|
return response;
|
|
373
369
|
}
|
|
@@ -401,6 +397,17 @@ let OpenaiApi = (function () {
|
|
|
401
397
|
return [...list.data];
|
|
402
398
|
}
|
|
403
399
|
|
|
400
|
+
async listFineTuningCheckpoints(parameters) {
|
|
401
|
+
const openai = new OpenAI(this.clientParams);
|
|
402
|
+
const { fine_tuning_job_id, ...params } = parameters.payload;
|
|
403
|
+
const list = await openai.fineTuning.jobs.checkpoints.list(
|
|
404
|
+
fine_tuning_job_id,
|
|
405
|
+
params,
|
|
406
|
+
);
|
|
407
|
+
|
|
408
|
+
return [...list.data];
|
|
409
|
+
}
|
|
410
|
+
|
|
404
411
|
async cancelFineTuningJob(parameters) {
|
|
405
412
|
const openai = new OpenAI(this.clientParams);
|
|
406
413
|
const { fine_tuning_job_id, ...params } = parameters.payload;
|
|
@@ -450,9 +457,7 @@ let OpenaiApi = (function () {
|
|
|
450
457
|
|
|
451
458
|
async createAssistant(parameters) {
|
|
452
459
|
const openai = new OpenAI(this.clientParams);
|
|
453
|
-
const response = await openai.beta.assistants.create(
|
|
454
|
-
parameters.payload,
|
|
455
|
-
);
|
|
460
|
+
const response = await openai.beta.assistants.create(parameters.payload);
|
|
456
461
|
|
|
457
462
|
return response;
|
|
458
463
|
}
|
|
@@ -689,7 +694,11 @@ let OpenaiApi = (function () {
|
|
|
689
694
|
async listRunSteps(parameters) {
|
|
690
695
|
const openai = new OpenAI(this.clientParams);
|
|
691
696
|
const { thread_id, run_id, ...params } = parameters.payload;
|
|
692
|
-
const list = await openai.beta.threads.runs.steps.list(
|
|
697
|
+
const list = await openai.beta.threads.runs.steps.list(
|
|
698
|
+
thread_id,
|
|
699
|
+
run_id,
|
|
700
|
+
params,
|
|
701
|
+
);
|
|
693
702
|
|
|
694
703
|
return [...list.data];
|
|
695
704
|
}
|
package/locales/de-DE/node.json
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"retrieveFineTuningJob": "retrieve fine-tuning job",
|
|
82
82
|
"fine_tuning_job_id": "fine-tuning job id",
|
|
83
83
|
"listFineTuningEvents": "list fine-tuning events",
|
|
84
|
+
"listFineTuningCheckpoints": "list fine-tuning checkpoints",
|
|
84
85
|
"cancelFineTuningJob": "cancel fine-tuning",
|
|
85
86
|
"createFineTune": "POST /fine-tunes",
|
|
86
87
|
"listFineTunes": "GET /fine-tunes",
|
package/locales/en-US/node.json
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"retrieveFineTuningJob": "retrieve fine-tuning job",
|
|
82
82
|
"fine_tuning_job_id": "fine-tuning job id",
|
|
83
83
|
"listFineTuningEvents": "list fine-tuning events",
|
|
84
|
+
"listFineTuningCheckpoints": "list fine-tuning checkpoints",
|
|
84
85
|
"cancelFineTuningJob": "cancel fine-tuning",
|
|
85
86
|
"createFineTune": "POST /fine-tunes",
|
|
86
87
|
"listFineTunes": "GET /fine-tunes",
|
package/locales/ja/node.json
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"retrieveFineTuningJob": "retrieve fine-tuning job",
|
|
82
82
|
"fine_tuning_job_id": "fine-tuning job id",
|
|
83
83
|
"listFineTuningEvents": "list fine-tuning events",
|
|
84
|
+
"listFineTuningCheckpoints": "list fine-tuning checkpoints",
|
|
84
85
|
"cancelFineTuningJob": "cancel fine-tuning",
|
|
85
86
|
"createFineTune": "POST /fine-tunes",
|
|
86
87
|
"listFineTunes": "GET /fine-tunes",
|
package/locales/zh-CN/node.json
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"retrieveFineTuningJob": "retrieve fine-tuning job",
|
|
82
82
|
"fine_tuning_job_id": "fine-tuning job id",
|
|
83
83
|
"listFineTuningEvents": "list fine-tuning events",
|
|
84
|
+
"listFineTuningCheckpoints": "list fine-tuning checkpoints",
|
|
84
85
|
"cancelFineTuningJob": "cancel fine-tuning",
|
|
85
86
|
"createFineTune": "POST /fine-tunes",
|
|
86
87
|
"listFineTunes": "GET /fine-tunes",
|
package/node.html
CHANGED
|
@@ -182,6 +182,10 @@
|
|
|
182
182
|
value="listFineTuningEvents"
|
|
183
183
|
data-i18n="OpenaiApi.parameters.listFineTuningEvents"
|
|
184
184
|
></option>
|
|
185
|
+
<option
|
|
186
|
+
value="listFineTuningCheckpoints"
|
|
187
|
+
data-i18n="OpenaiApi.parameters.listFineTuningCheckpoints"
|
|
188
|
+
></option>
|
|
185
189
|
<option
|
|
186
190
|
value="cancelFineTuningJob"
|
|
187
191
|
data-i18n="OpenaiApi.parameters.cancelFineTuningJob"
|
|
@@ -1799,6 +1803,47 @@
|
|
|
1799
1803
|
<dd>Number of events to retrieve.</dd>
|
|
1800
1804
|
</dl>
|
|
1801
1805
|
|
|
1806
|
+
<!-- >>> Begin List Fine-tuning Checkpoints -->
|
|
1807
|
+
<h4 style="font-weight: bolder;"> ⋙ List Fine-tuning Checkpoints</h4>
|
|
1808
|
+
<p>List checkpoints for a fine-tuning job.</p>
|
|
1809
|
+
<dl class="message-properties">
|
|
1810
|
+
<h4>msg.payload Properties</h4>
|
|
1811
|
+
|
|
1812
|
+
<dt>
|
|
1813
|
+
fine_tuning_job_id
|
|
1814
|
+
<a
|
|
1815
|
+
href="https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints#fine-tuning-list-checkpoints-fine_tuning_job_id"
|
|
1816
|
+
target="_blank"
|
|
1817
|
+
><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
|
|
1818
|
+
></a>
|
|
1819
|
+
<span class="property-type">string</span>
|
|
1820
|
+
</dt>
|
|
1821
|
+
<dd>The ID of the fine-tuning job to get checkpoints for.</dd>
|
|
1822
|
+
<dt class="optional">
|
|
1823
|
+
after
|
|
1824
|
+
<a
|
|
1825
|
+
href="https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints#fine-tuning-list-checkpoints-after"
|
|
1826
|
+
target="_blank"
|
|
1827
|
+
><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
|
|
1828
|
+
></a>
|
|
1829
|
+
<span class="property-type">string</span>
|
|
1830
|
+
</dt>
|
|
1831
|
+
<dd>
|
|
1832
|
+
Identifier for the last checkpoint ID from the previous pagination request.
|
|
1833
|
+
</dd>
|
|
1834
|
+
<dt class="optional">
|
|
1835
|
+
limit
|
|
1836
|
+
<a
|
|
1837
|
+
href="https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints#fine-tuning-list-checkpoints-limit"
|
|
1838
|
+
target="_blank"
|
|
1839
|
+
><i class="fa fa-external-link fa-sm" aria-hidden="true"></i
|
|
1840
|
+
></a>
|
|
1841
|
+
<span class="property-type">integer</span>
|
|
1842
|
+
</dt>
|
|
1843
|
+
<dd>Number of events to retrieve.</dd>
|
|
1844
|
+
</dl>
|
|
1845
|
+
<!-- <<< End List Fine-tuning Checkpoints -->
|
|
1846
|
+
|
|
1802
1847
|
<h4 style="font-weight: bolder;"> ⋙ Cancel Fine-tuning Job</h4>
|
|
1803
1848
|
<p>Immediately cancel a fine-tune job.</p>
|
|
1804
1849
|
<dl class="message-properties">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inductiv/node-red-openai-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Enhance your Node-RED flows with advanced AI capabilities.",
|
|
5
5
|
"main": "node.js",
|
|
6
6
|
"engines": {
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
"low-code"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"openai": "^4.
|
|
37
|
+
"openai": "^4.40.2"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"eslint": "^8.54.0",
|
|
41
|
+
"eslint-plugin-jest": "^28.5.0",
|
|
41
42
|
"prettier": "^3.1.0"
|
|
42
43
|
},
|
|
43
44
|
"author": "Allan Bunch",
|
|
@@ -46,4 +47,4 @@
|
|
|
46
47
|
"type": "git",
|
|
47
48
|
"url": "git+https://github.com/allanbunch/node-red-openai-api.git"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|