@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/LICENSE +7 -0
- package/README.md +66 -0
- package/examples/assistants.json +442 -0
- package/examples/audio.json +122 -0
- package/examples/chat.json +87 -0
- package/examples/embeddings.json +72 -0
- package/examples/files.json +72 -0
- package/examples/fine-tuning.json +72 -0
- package/examples/images.json +82 -0
- package/examples/messages.json +77 -0
- package/examples/models.json +92 -0
- package/examples/moderations.json +77 -0
- package/examples/runs.json +77 -0
- package/examples/threads.json +67 -0
- package/icons/icon.png +0 -0
- package/lib.js +617 -0
- package/locales/de-DE/node.json +112 -0
- package/locales/en-US/node.json +112 -0
- package/locales/ja/node.json +112 -0
- package/locales/zh-CN/node.json +112 -0
- package/node.html +771 -0
- package/node.js +256 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Copyright 2023 Allan Bunch
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
Low-code AI for Innovators with Deadlines
|
|
3
|
+
<br>
|
|
4
|
+
<a href="https://github.com/allanbunch/node-red-openai-api"> <img width="923" alt="assistants-example" src="https://github.com/allanbunch/node-red-openai-api/assets/4503640/204dce33-0b9f-4c6a-8665-b1e69dab21b5">
|
|
5
|
+
</a>
|
|
6
|
+
<br>
|
|
7
|
+
@inductiv/node-red-openai-api
|
|
8
|
+
</h1>
|
|
9
|
+
|
|
10
|
+
_@inductiv/node-red-openai-api_ offers a versatile and configurable Node-RED node, designed specifically for seamless integration with OpenAI's advanced platform services. It empowers you to effortlessly connect and orchestrate various OpenAI functionalities, leveraging the full power of Node-RED's sophisticated application nodes. Whether you're aiming to enhance your workflows with cutting-edge AI capabilities or create innovative applications, this node serves as your gateway to harnessing the latest in AI technology from OpenAI, all within the intuitive and flexible environment of Node-RED.
|
|
11
|
+
|
|
12
|
+
## Key Features
|
|
13
|
+
|
|
14
|
+
- **Seamless Integration**: Directly connect with OpenAI services without the hassle of complex coding or setup.
|
|
15
|
+
- **Configurable and Flexible**: Designed for adaptability, this node can be easily configured to suit a wide range of project requirements, streamlining your development workflow.
|
|
16
|
+
- **Powerful Combinations**: Take advantage of Node-RED's diverse nodes to build complex, AI-driven workflows with ease.
|
|
17
|
+
|
|
18
|
+
Ideal for developers, researchers, and innovators, this node is your tool for unlocking the full potential of AI in your projects.
|
|
19
|
+
|
|
20
|
+
## Table of Contents
|
|
21
|
+
|
|
22
|
+
- [Installation](#installation)
|
|
23
|
+
- [Usage](#usage)
|
|
24
|
+
- [License](#license)
|
|
25
|
+
- [Acknowledgements](#acknowledgements)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
Via the Node-RED Palette Manager, install
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
@inductiv/node-red-openai-api
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Via NPM
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd $HOME/.node-red
|
|
39
|
+
npm i @inductiv/node-red-openai-api
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Find your _@inductiv/node-red-openai-api_ node in the **AI** palette category.
|
|
45
|
+
|
|
46
|
+
<img width="122" alt="inductiv-node-red-openai-api-node" src="https://github.com/allanbunch/node-red-openai-api/assets/4503640/55b6528a-0f94-4e24-8c98-f47104624651">
|
|
47
|
+
|
|
48
|
+
You'll find a set of example implementation flows in the [examples](./examples/) directory.
|
|
49
|
+
|
|
50
|
+
<img width="722" alt="audio-translation" src="https://github.com/allanbunch/node-red-openai-api/assets/4503640/4f2aa5c2-87a9-4cad-af32-10bca094141c">
|
|
51
|
+
|
|
52
|
+
Note: Each node's functionality maps to the official OpenAI [API Reference](https://platform.openai.com/docs/api-reference/) documentation.
|
|
53
|
+
|
|
54
|
+
Node contains inutitive inline help with links to OpenAI's official API documentation.
|
|
55
|
+
|
|
56
|
+
<img width="619" alt="inductiv-node-red-openai-api-node-config" src="https://github.com/allanbunch/node-red-openai-api/assets/4503640/15ee5b75-2e29-4806-b427-8e6873f3fb96">
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
[MIT](./LICENSE)
|
|
61
|
+
|
|
62
|
+
## Acknowledgements
|
|
63
|
+
|
|
64
|
+
- [node-red-nodegen](https://github.com/node-red/node-red-nodegen)
|
|
65
|
+
- For boilerplate code generation, though the auto-generated code has been largely refactored.
|
|
66
|
+
- **Note:** This package uses `axios` in place of node-red-nodegen's `request` default.
|
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "78b174792ca9efaf",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "Assistants Example",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "",
|
|
8
|
+
"env": []
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "3aed22e8a8626b49",
|
|
12
|
+
"type": "group",
|
|
13
|
+
"z": "78b174792ca9efaf",
|
|
14
|
+
"style": {
|
|
15
|
+
"stroke": "#999999",
|
|
16
|
+
"stroke-opacity": "1",
|
|
17
|
+
"fill": "none",
|
|
18
|
+
"fill-opacity": "1",
|
|
19
|
+
"label": true,
|
|
20
|
+
"label-position": "nw",
|
|
21
|
+
"color": "#a4a4a4"
|
|
22
|
+
},
|
|
23
|
+
"nodes": [
|
|
24
|
+
"a1dd9dd38256bc37",
|
|
25
|
+
"94c58ec5fd3ce89a",
|
|
26
|
+
"78bae2355d746f5b",
|
|
27
|
+
"16fd166e2cfe1aec",
|
|
28
|
+
"54cdefbcbbec117f",
|
|
29
|
+
"e0007c022bce36b9",
|
|
30
|
+
"e5b83cdfc84c22f9",
|
|
31
|
+
"6ada9879e91ef156",
|
|
32
|
+
"a08cc5475a20cc70"
|
|
33
|
+
],
|
|
34
|
+
"x": 94,
|
|
35
|
+
"y": 113,
|
|
36
|
+
"w": 1492,
|
|
37
|
+
"h": 374
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "6ada9879e91ef156",
|
|
41
|
+
"type": "group",
|
|
42
|
+
"z": "78b174792ca9efaf",
|
|
43
|
+
"g": "3aed22e8a8626b49",
|
|
44
|
+
"style": {
|
|
45
|
+
"stroke": "#999999",
|
|
46
|
+
"stroke-opacity": "1",
|
|
47
|
+
"fill": "none",
|
|
48
|
+
"fill-opacity": "1",
|
|
49
|
+
"label": true,
|
|
50
|
+
"label-position": "nw",
|
|
51
|
+
"color": "#a4a4a4"
|
|
52
|
+
},
|
|
53
|
+
"nodes": [
|
|
54
|
+
"e6cb8abd4fe85ef3",
|
|
55
|
+
"7a825447030eb842",
|
|
56
|
+
"e78656f2a1db4141",
|
|
57
|
+
"50dc0daeab93f1d7",
|
|
58
|
+
"a342bcf840361d49",
|
|
59
|
+
"da5c242d75d45b1a"
|
|
60
|
+
],
|
|
61
|
+
"x": 454,
|
|
62
|
+
"y": 139,
|
|
63
|
+
"w": 912,
|
|
64
|
+
"h": 122
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "a08cc5475a20cc70",
|
|
68
|
+
"type": "group",
|
|
69
|
+
"z": "78b174792ca9efaf",
|
|
70
|
+
"g": "3aed22e8a8626b49",
|
|
71
|
+
"style": {
|
|
72
|
+
"stroke": "#999999",
|
|
73
|
+
"stroke-opacity": "1",
|
|
74
|
+
"fill": "none",
|
|
75
|
+
"fill-opacity": "1",
|
|
76
|
+
"label": true,
|
|
77
|
+
"label-position": "nw",
|
|
78
|
+
"color": "#a4a4a4"
|
|
79
|
+
},
|
|
80
|
+
"nodes": [
|
|
81
|
+
"43d56c48fd18dd0b",
|
|
82
|
+
"d0ed57739e76eba4"
|
|
83
|
+
],
|
|
84
|
+
"x": 454,
|
|
85
|
+
"y": 339,
|
|
86
|
+
"w": 212,
|
|
87
|
+
"h": 122
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "a1dd9dd38256bc37",
|
|
91
|
+
"type": "debug",
|
|
92
|
+
"z": "78b174792ca9efaf",
|
|
93
|
+
"g": "3aed22e8a8626b49",
|
|
94
|
+
"name": "response",
|
|
95
|
+
"active": true,
|
|
96
|
+
"tosidebar": true,
|
|
97
|
+
"console": false,
|
|
98
|
+
"tostatus": false,
|
|
99
|
+
"complete": "true",
|
|
100
|
+
"targetType": "full",
|
|
101
|
+
"statusVal": "",
|
|
102
|
+
"statusType": "auto",
|
|
103
|
+
"x": 760,
|
|
104
|
+
"y": 380,
|
|
105
|
+
"wires": []
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "94c58ec5fd3ce89a",
|
|
109
|
+
"type": "inject",
|
|
110
|
+
"z": "78b174792ca9efaf",
|
|
111
|
+
"g": "3aed22e8a8626b49",
|
|
112
|
+
"name": "assistant payload",
|
|
113
|
+
"props": [
|
|
114
|
+
{
|
|
115
|
+
"p": "topic",
|
|
116
|
+
"vt": "str"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"p": "payload"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"p": "assistant.name",
|
|
123
|
+
"v": "My Node-RED Assistant",
|
|
124
|
+
"vt": "str"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"p": "assistant.model",
|
|
128
|
+
"v": "gpt-4-1106-preview",
|
|
129
|
+
"vt": "str"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"p": "assistant.tools",
|
|
133
|
+
"v": "[{\"type\":\"retrieval\"}]",
|
|
134
|
+
"vt": "json"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"p": "assistant.description",
|
|
138
|
+
"v": "My helpful assistant.",
|
|
139
|
+
"vt": "str"
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"p": "assistant.instructions",
|
|
143
|
+
"v": "You are a helpful assistant with access to files that I share with you.",
|
|
144
|
+
"vt": "str"
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"repeat": "",
|
|
148
|
+
"crontab": "",
|
|
149
|
+
"once": false,
|
|
150
|
+
"onceDelay": 0.1,
|
|
151
|
+
"topic": "retrieval",
|
|
152
|
+
"payload": "[\"/path/to/my_file_1.pdf\",\"/path/to/my_file_2.txt\"]",
|
|
153
|
+
"payloadType": "json",
|
|
154
|
+
"x": 220,
|
|
155
|
+
"y": 220,
|
|
156
|
+
"wires": [
|
|
157
|
+
[
|
|
158
|
+
"78bae2355d746f5b"
|
|
159
|
+
]
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "78bae2355d746f5b",
|
|
164
|
+
"type": "switch",
|
|
165
|
+
"z": "78b174792ca9efaf",
|
|
166
|
+
"g": "3aed22e8a8626b49",
|
|
167
|
+
"name": "assistant type switch",
|
|
168
|
+
"property": "topic",
|
|
169
|
+
"propertyType": "msg",
|
|
170
|
+
"rules": [
|
|
171
|
+
{
|
|
172
|
+
"t": "eq",
|
|
173
|
+
"v": "retrieval",
|
|
174
|
+
"vt": "str"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"t": "else"
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"checkall": "true",
|
|
181
|
+
"repair": false,
|
|
182
|
+
"outputs": 2,
|
|
183
|
+
"x": 300,
|
|
184
|
+
"y": 300,
|
|
185
|
+
"wires": [
|
|
186
|
+
[
|
|
187
|
+
"7a825447030eb842"
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
"43d56c48fd18dd0b"
|
|
191
|
+
]
|
|
192
|
+
],
|
|
193
|
+
"outputLabels": [
|
|
194
|
+
"Document-enhanced Agent",
|
|
195
|
+
"Standard Agent"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "16fd166e2cfe1aec",
|
|
200
|
+
"type": "comment",
|
|
201
|
+
"z": "78b174792ca9efaf",
|
|
202
|
+
"g": "3aed22e8a8626b49",
|
|
203
|
+
"name": "Document-Enhanced Assistant",
|
|
204
|
+
"info": "",
|
|
205
|
+
"x": 250,
|
|
206
|
+
"y": 180,
|
|
207
|
+
"wires": []
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "54cdefbcbbec117f",
|
|
211
|
+
"type": "inject",
|
|
212
|
+
"z": "78b174792ca9efaf",
|
|
213
|
+
"g": "3aed22e8a8626b49",
|
|
214
|
+
"name": "assistant payload",
|
|
215
|
+
"props": [
|
|
216
|
+
{
|
|
217
|
+
"p": "payload.name",
|
|
218
|
+
"v": "My Node-RED Standard Assistant",
|
|
219
|
+
"vt": "str"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"p": "payload.model",
|
|
223
|
+
"v": "gpt-4-1106-preview",
|
|
224
|
+
"vt": "str"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"p": "payload.tools",
|
|
228
|
+
"v": "[{\"type\":\"code_interpreter\"}]",
|
|
229
|
+
"vt": "json"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"p": "payload.description",
|
|
233
|
+
"v": "My helpful standard assistant.",
|
|
234
|
+
"vt": "str"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"p": "payload.instructions",
|
|
238
|
+
"v": "You are a helpful assistant.",
|
|
239
|
+
"vt": "str"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"repeat": "",
|
|
243
|
+
"crontab": "",
|
|
244
|
+
"once": false,
|
|
245
|
+
"onceDelay": 0.1,
|
|
246
|
+
"topic": "",
|
|
247
|
+
"x": 220,
|
|
248
|
+
"y": 380,
|
|
249
|
+
"wires": [
|
|
250
|
+
[
|
|
251
|
+
"78bae2355d746f5b"
|
|
252
|
+
]
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"id": "e0007c022bce36b9",
|
|
257
|
+
"type": "function",
|
|
258
|
+
"z": "78b174792ca9efaf",
|
|
259
|
+
"g": "3aed22e8a8626b49",
|
|
260
|
+
"name": "structure assistant",
|
|
261
|
+
"func": "// create an array of IDs from the fil upload response.\nconst file_ids = msg.payload.map(element => element.id);\n\n// attach the file IDs to the assistant.\nmsg.assistant.file_ids = file_ids;\n\nmsg.payload = msg.assistant;\n\n// discard the temporary assistant object.\ndelete msg.assistant;\n\nreturn msg;",
|
|
262
|
+
"outputs": 1,
|
|
263
|
+
"timeout": 0,
|
|
264
|
+
"noerr": 0,
|
|
265
|
+
"initialize": "",
|
|
266
|
+
"finalize": "",
|
|
267
|
+
"libs": [],
|
|
268
|
+
"x": 1470,
|
|
269
|
+
"y": 220,
|
|
270
|
+
"wires": [
|
|
271
|
+
[
|
|
272
|
+
"43d56c48fd18dd0b"
|
|
273
|
+
]
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"id": "e5b83cdfc84c22f9",
|
|
278
|
+
"type": "comment",
|
|
279
|
+
"z": "78b174792ca9efaf",
|
|
280
|
+
"g": "3aed22e8a8626b49",
|
|
281
|
+
"name": "Standard Assistant",
|
|
282
|
+
"info": "",
|
|
283
|
+
"x": 210,
|
|
284
|
+
"y": 420,
|
|
285
|
+
"wires": []
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"id": "e6cb8abd4fe85ef3",
|
|
289
|
+
"type": "file in",
|
|
290
|
+
"z": "78b174792ca9efaf",
|
|
291
|
+
"g": "6ada9879e91ef156",
|
|
292
|
+
"name": "read file",
|
|
293
|
+
"filename": "payload",
|
|
294
|
+
"filenameType": "msg",
|
|
295
|
+
"format": "",
|
|
296
|
+
"chunk": false,
|
|
297
|
+
"sendError": false,
|
|
298
|
+
"encoding": "none",
|
|
299
|
+
"allProps": false,
|
|
300
|
+
"x": 740,
|
|
301
|
+
"y": 220,
|
|
302
|
+
"wires": [
|
|
303
|
+
[
|
|
304
|
+
"da5c242d75d45b1a"
|
|
305
|
+
]
|
|
306
|
+
]
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"id": "7a825447030eb842",
|
|
310
|
+
"type": "split",
|
|
311
|
+
"z": "78b174792ca9efaf",
|
|
312
|
+
"g": "6ada9879e91ef156",
|
|
313
|
+
"name": "get file names",
|
|
314
|
+
"splt": "\\n",
|
|
315
|
+
"spltType": "str",
|
|
316
|
+
"arraySplt": 1,
|
|
317
|
+
"arraySpltType": "len",
|
|
318
|
+
"stream": false,
|
|
319
|
+
"addname": "",
|
|
320
|
+
"x": 560,
|
|
321
|
+
"y": 220,
|
|
322
|
+
"wires": [
|
|
323
|
+
[
|
|
324
|
+
"e6cb8abd4fe85ef3"
|
|
325
|
+
]
|
|
326
|
+
]
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
"id": "e78656f2a1db4141",
|
|
330
|
+
"type": "join",
|
|
331
|
+
"z": "78b174792ca9efaf",
|
|
332
|
+
"g": "6ada9879e91ef156",
|
|
333
|
+
"name": "gather file ids",
|
|
334
|
+
"mode": "auto",
|
|
335
|
+
"build": "object",
|
|
336
|
+
"property": "payload",
|
|
337
|
+
"propertyType": "msg",
|
|
338
|
+
"key": "topic",
|
|
339
|
+
"joiner": "\\n",
|
|
340
|
+
"joinerType": "str",
|
|
341
|
+
"accumulate": true,
|
|
342
|
+
"timeout": "",
|
|
343
|
+
"count": "",
|
|
344
|
+
"reduceRight": false,
|
|
345
|
+
"reduceExp": "",
|
|
346
|
+
"reduceInit": "",
|
|
347
|
+
"reduceInitType": "",
|
|
348
|
+
"reduceFixup": "",
|
|
349
|
+
"x": 1270,
|
|
350
|
+
"y": 220,
|
|
351
|
+
"wires": [
|
|
352
|
+
[
|
|
353
|
+
"e0007c022bce36b9"
|
|
354
|
+
]
|
|
355
|
+
]
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"id": "50dc0daeab93f1d7",
|
|
359
|
+
"type": "openai-api",
|
|
360
|
+
"z": "78b174792ca9efaf",
|
|
361
|
+
"g": "6ada9879e91ef156",
|
|
362
|
+
"name": "upload files",
|
|
363
|
+
"service": "808a04cb8707d787",
|
|
364
|
+
"method": "createFile",
|
|
365
|
+
"x": 1090,
|
|
366
|
+
"y": 220,
|
|
367
|
+
"wires": [
|
|
368
|
+
[
|
|
369
|
+
"e78656f2a1db4141"
|
|
370
|
+
]
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"id": "a342bcf840361d49",
|
|
375
|
+
"type": "comment",
|
|
376
|
+
"z": "78b174792ca9efaf",
|
|
377
|
+
"g": "6ada9879e91ef156",
|
|
378
|
+
"name": "Upload Files",
|
|
379
|
+
"info": "",
|
|
380
|
+
"x": 550,
|
|
381
|
+
"y": 180,
|
|
382
|
+
"wires": []
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
"id": "da5c242d75d45b1a",
|
|
386
|
+
"type": "function",
|
|
387
|
+
"z": "78b174792ca9efaf",
|
|
388
|
+
"g": "6ada9879e91ef156",
|
|
389
|
+
"name": "structure file",
|
|
390
|
+
"func": "msg.payload = {\n \"file\": msg.payload,\n \"purpose\": \"assistants\",\n \"filename\": msg.filename\n};\nreturn msg;",
|
|
391
|
+
"outputs": 1,
|
|
392
|
+
"timeout": 0,
|
|
393
|
+
"noerr": 0,
|
|
394
|
+
"initialize": "",
|
|
395
|
+
"finalize": "",
|
|
396
|
+
"libs": [],
|
|
397
|
+
"x": 910,
|
|
398
|
+
"y": 220,
|
|
399
|
+
"wires": [
|
|
400
|
+
[
|
|
401
|
+
"50dc0daeab93f1d7"
|
|
402
|
+
]
|
|
403
|
+
]
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"id": "43d56c48fd18dd0b",
|
|
407
|
+
"type": "openai-api",
|
|
408
|
+
"z": "78b174792ca9efaf",
|
|
409
|
+
"g": "a08cc5475a20cc70",
|
|
410
|
+
"name": "create assistant",
|
|
411
|
+
"service": "39eba92e93450944",
|
|
412
|
+
"method": "createAssistant",
|
|
413
|
+
"x": 560,
|
|
414
|
+
"y": 380,
|
|
415
|
+
"wires": [
|
|
416
|
+
[
|
|
417
|
+
"a1dd9dd38256bc37"
|
|
418
|
+
]
|
|
419
|
+
]
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
"id": "d0ed57739e76eba4",
|
|
423
|
+
"type": "comment",
|
|
424
|
+
"z": "78b174792ca9efaf",
|
|
425
|
+
"g": "a08cc5475a20cc70",
|
|
426
|
+
"name": "Create Assistant",
|
|
427
|
+
"info": "",
|
|
428
|
+
"x": 560,
|
|
429
|
+
"y": 420,
|
|
430
|
+
"wires": []
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"id": "e3812b47c1b7b918",
|
|
434
|
+
"type": "comment",
|
|
435
|
+
"z": "78b174792ca9efaf",
|
|
436
|
+
"name": "Create Assistants",
|
|
437
|
+
"info": "",
|
|
438
|
+
"x": 180,
|
|
439
|
+
"y": 80,
|
|
440
|
+
"wires": []
|
|
441
|
+
}
|
|
442
|
+
]
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "a8f46f8122644718",
|
|
4
|
+
"type": "tab",
|
|
5
|
+
"label": "Audio Example",
|
|
6
|
+
"disabled": false,
|
|
7
|
+
"info": "",
|
|
8
|
+
"env": []
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"id": "467ebc87b8844787",
|
|
12
|
+
"type": "inject",
|
|
13
|
+
"z": "a8f46f8122644718",
|
|
14
|
+
"name": "translation payload",
|
|
15
|
+
"props": [
|
|
16
|
+
{
|
|
17
|
+
"p": "filename",
|
|
18
|
+
"v": "/path/to/my_file.mp3",
|
|
19
|
+
"vt": "str"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"p": "model",
|
|
23
|
+
"v": "whisper-1",
|
|
24
|
+
"vt": "str"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"repeat": "",
|
|
28
|
+
"crontab": "",
|
|
29
|
+
"once": false,
|
|
30
|
+
"onceDelay": 0.1,
|
|
31
|
+
"topic": "",
|
|
32
|
+
"x": 190,
|
|
33
|
+
"y": 260,
|
|
34
|
+
"wires": [
|
|
35
|
+
[
|
|
36
|
+
"3a737dfa6879caa2"
|
|
37
|
+
]
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "72303cea19bd9de9",
|
|
42
|
+
"type": "openai-api",
|
|
43
|
+
"z": "a8f46f8122644718",
|
|
44
|
+
"name": "translator",
|
|
45
|
+
"service": "808a04cb8707d787",
|
|
46
|
+
"method": "createTranslation",
|
|
47
|
+
"x": 760,
|
|
48
|
+
"y": 260,
|
|
49
|
+
"wires": [
|
|
50
|
+
[
|
|
51
|
+
"b6fdacab7fb309bd"
|
|
52
|
+
]
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "b6fdacab7fb309bd",
|
|
57
|
+
"type": "debug",
|
|
58
|
+
"z": "a8f46f8122644718",
|
|
59
|
+
"name": "response",
|
|
60
|
+
"active": true,
|
|
61
|
+
"tosidebar": true,
|
|
62
|
+
"console": false,
|
|
63
|
+
"tostatus": false,
|
|
64
|
+
"complete": "payload",
|
|
65
|
+
"targetType": "msg",
|
|
66
|
+
"statusVal": "",
|
|
67
|
+
"statusType": "auto",
|
|
68
|
+
"x": 920,
|
|
69
|
+
"y": 260,
|
|
70
|
+
"wires": []
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "3a737dfa6879caa2",
|
|
74
|
+
"type": "file in",
|
|
75
|
+
"z": "a8f46f8122644718",
|
|
76
|
+
"name": "audio file",
|
|
77
|
+
"filename": "filename",
|
|
78
|
+
"filenameType": "msg",
|
|
79
|
+
"format": "",
|
|
80
|
+
"chunk": false,
|
|
81
|
+
"sendError": false,
|
|
82
|
+
"encoding": "utf-16be",
|
|
83
|
+
"allProps": false,
|
|
84
|
+
"x": 380,
|
|
85
|
+
"y": 260,
|
|
86
|
+
"wires": [
|
|
87
|
+
[
|
|
88
|
+
"6e882571ec7d2180"
|
|
89
|
+
]
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id": "4a3af447f46156b8",
|
|
94
|
+
"type": "comment",
|
|
95
|
+
"z": "a8f46f8122644718",
|
|
96
|
+
"name": "Audio Translation",
|
|
97
|
+
"info": "",
|
|
98
|
+
"x": 160,
|
|
99
|
+
"y": 220,
|
|
100
|
+
"wires": []
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "6e882571ec7d2180",
|
|
104
|
+
"type": "function",
|
|
105
|
+
"z": "a8f46f8122644718",
|
|
106
|
+
"name": "structure payload",
|
|
107
|
+
"func": "let newPayload = {};\n\nnewPayload.file = msg.payload;\nnewPayload.model = msg.model;\nnewPayload.filename = msg.filename;\n\nmsg.payload = newPayload;\n\ndelete msg.model;\ndelete msg.filename;\n\nreturn msg;",
|
|
108
|
+
"outputs": 1,
|
|
109
|
+
"timeout": 0,
|
|
110
|
+
"noerr": 0,
|
|
111
|
+
"initialize": "",
|
|
112
|
+
"finalize": "",
|
|
113
|
+
"libs": [],
|
|
114
|
+
"x": 570,
|
|
115
|
+
"y": 260,
|
|
116
|
+
"wires": [
|
|
117
|
+
[
|
|
118
|
+
"72303cea19bd9de9"
|
|
119
|
+
]
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|