@inductiv/node-red-openai-api 1.2.0 → 1.3.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 +36 -33
- package/lib.js +4 -12
- package/node.js +3 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
# @inductiv/node-red-openai-api
|
|
3
|
+
|
|
4
|
+
   
|
|
5
|
+
|
|
6
|
+
This library provides convenient access to the OpenAI Node API Library from Node-RED.
|
|
7
|
+
|
|
4
8
|
<a href="https://github.com/allanbunch/node-red-openai-api">
|
|
5
9
|
<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
10
|
</a>
|
|
7
11
|
<br>
|
|
12
|
+
|
|
13
|
+
Node-RED OpenAI API is a versatile and configurable Node-RED node designed for seamless integration with any OpenAI API compatible platform. This node empowers innovators and developers to effortlessly connect and orchestrate complex AI and IoT workflows, leveraging Node-RED's sophisticated ecosystem. Ideal for enhancing IoT operations with advanced AI capabilities, this node serves as your gateway to applying the latest AI technology in an IoT context, facilitating innovative applications across diverse environments.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Via Node-RED Palette Manager
|
|
18
|
+
|
|
19
|
+
```text
|
|
8
20
|
@inductiv/node-red-openai-api
|
|
9
|
-
|
|
21
|
+
```
|
|
10
22
|
|
|
11
|
-
|
|
23
|
+
### Via NPM
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd $HOME/.node-red # or the location of your Node-RED configuration directory.
|
|
27
|
+
npm i @inductiv/node-red-openai-api
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
After installation, find your node in the **AI** palette category labeled "OpenAI API". Here's how you can start integrating AI into your IoT projects:
|
|
33
|
+
|
|
34
|
+
1. Configure the node with your AI platform's API key (if required).
|
|
35
|
+
2. Send [OpenAI documented](https://platform.openai.com/docs/api-reference/) API service configuration paramaters to the node using the default `msg.payload` property, or confiure your desired incoming object property reference on the node itself.
|
|
36
|
+
3. Explore the [examples](./examples/) directory for sample implementations.
|
|
12
37
|
|
|
13
38
|
## Core Features
|
|
14
39
|
|
|
@@ -16,11 +41,12 @@ Welcome to _@inductiv/node-red-openai-api_, a versatile and configurable Node-RE
|
|
|
16
41
|
- **Configurable and Flexible**: Adapt to a wide range of project requirements, making it easy to integrate AI into your IoT solutions.
|
|
17
42
|
- **Powerful Combinations**: Utilize Node-RED's diverse nodes to build complex, AI-driven IoT workflows with ease.
|
|
18
43
|
|
|
19
|
-
## Release Notes (v1.
|
|
44
|
+
## Release Notes (v1.3.0)
|
|
20
45
|
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
46
|
+
- Streamed responses now share the same `msg._msgid` value
|
|
47
|
+
- Upgraded to OpenAI Node API Library v4.42.0
|
|
48
|
+
- Updated the node's documentation panel
|
|
49
|
+
- Code stability & formatting updates
|
|
24
50
|
|
|
25
51
|
## What's New in Version 1.x
|
|
26
52
|
|
|
@@ -34,36 +60,13 @@ Version 1.0 of the **node-red-openai-api** node brings significant enhancements
|
|
|
34
60
|
|
|
35
61
|
### Important Notice Regarding Compatibility
|
|
36
62
|
|
|
37
|
-
- **Backward Incompatible Changes**: Please be aware that
|
|
63
|
+
- **Backward Incompatible Changes**: Please be aware that v1.0 includes breaking changes that may affect existing implementations (v0.x.x instllations) due to the updated OpenAI NodeJS package:
|
|
38
64
|
- The API call structure and parameters have been refined to align with the latest OpenAI specifications.
|
|
39
65
|
- Some functions and settings from previous versions may no longer be compatible with this update.
|
|
40
66
|
- List responses now exist at the top level of the `msg.payload` object; previously `msg.payload.data`.
|
|
41
67
|
|
|
42
68
|
I recommend reviewing current setups 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.
|
|
43
69
|
|
|
44
|
-
## Installation
|
|
45
|
-
|
|
46
|
-
### Via Node-RED Palette Manager
|
|
47
|
-
|
|
48
|
-
```text
|
|
49
|
-
@inductiv/node-red-openai-api
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Via NPM
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
cd $HOME/.node-red
|
|
56
|
-
npm i @inductiv/node-red-openai-api
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Usage
|
|
60
|
-
|
|
61
|
-
After installation, find your node in the **AI** palette category labeled "OpenAI API". Here's how you can start integrating AI into your IoT projects:
|
|
62
|
-
|
|
63
|
-
1. Configure the node with your AI platform's API key (if required).
|
|
64
|
-
2. Send [OpenAI documented](https://platform.openai.com/docs/api-reference/) API service configuration paramaters to the node using the default `msg.payload` property, or confiure your desired incoming object property reference on the node itself.
|
|
65
|
-
3. Explore the [examples](./examples/) directory for sample implementations.
|
|
66
|
-
|
|
67
70
|
## Contribute
|
|
68
71
|
|
|
69
72
|
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
|
@@ -240,9 +240,7 @@ let OpenaiApi = (function () {
|
|
|
240
240
|
});
|
|
241
241
|
for await (const chunk of response) {
|
|
242
242
|
if (typeof chunk === "object") {
|
|
243
|
-
|
|
244
|
-
newMsg.payload = chunk;
|
|
245
|
-
|
|
243
|
+
const newMsg = { ...parameters.msg, payload: chunk };
|
|
246
244
|
_node.send(newMsg);
|
|
247
245
|
}
|
|
248
246
|
}
|
|
@@ -579,9 +577,7 @@ let OpenaiApi = (function () {
|
|
|
579
577
|
});
|
|
580
578
|
for await (const chunk of response) {
|
|
581
579
|
if (typeof chunk === "object") {
|
|
582
|
-
|
|
583
|
-
newMsg.payload = chunk.data;
|
|
584
|
-
|
|
580
|
+
const newMsg = { ...parameters.msg, payload: chunk.data };
|
|
585
581
|
_node.send(newMsg);
|
|
586
582
|
}
|
|
587
583
|
}
|
|
@@ -613,9 +609,7 @@ let OpenaiApi = (function () {
|
|
|
613
609
|
});
|
|
614
610
|
for await (const chunk of response) {
|
|
615
611
|
if (typeof chunk === "object") {
|
|
616
|
-
|
|
617
|
-
newMsg.payload = chunk.data;
|
|
618
|
-
|
|
612
|
+
const newMsg = { ...parameters.msg, payload: chunk.data };
|
|
619
613
|
_node.send(newMsg);
|
|
620
614
|
}
|
|
621
615
|
}
|
|
@@ -667,9 +661,7 @@ let OpenaiApi = (function () {
|
|
|
667
661
|
});
|
|
668
662
|
for await (const chunk of response) {
|
|
669
663
|
if (typeof chunk === "object") {
|
|
670
|
-
|
|
671
|
-
newMsg.payload = chunk.data;
|
|
672
|
-
|
|
664
|
+
const newMsg = { ...parameters.msg, payload: chunk.data };
|
|
673
665
|
_node.send(newMsg);
|
|
674
666
|
}
|
|
675
667
|
}
|
package/node.js
CHANGED
|
@@ -35,9 +35,9 @@ module.exports = function (RED) {
|
|
|
35
35
|
const serviceName = node.config.method; // Set the service name to call.
|
|
36
36
|
|
|
37
37
|
let serviceParametersObject = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
_node: node,
|
|
39
|
+
payload: payload,
|
|
40
|
+
msg: msg,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
// Dynamically call the function based on the service name
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inductiv/node-red-openai-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Enhance your Node-RED flows with advanced AI capabilities.",
|
|
5
5
|
"main": "node.js",
|
|
6
6
|
"engines": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"low-code"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"openai": "
|
|
37
|
+
"openai": "~4.42.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"eslint": "^8.54.0",
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "git+https://github.com/allanbunch/node-red-openai-api.git"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|