@inductiv/node-red-openai-api 1.87.3 → 1.103.0-patch.1

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.
Files changed (73) hide show
  1. package/README.md +20 -40
  2. package/examples/responses/mcp.json +87 -0
  3. package/gulpfile.js +15 -0
  4. package/lib.js +16420 -538
  5. package/locales/en-US/node.json +10 -0
  6. package/node.html +3050 -3842
  7. package/node.js +3 -2
  8. package/package.json +13 -2
  9. package/src/assistants/help.html +353 -0
  10. package/src/assistants/methods.js +47 -0
  11. package/src/assistants/template.html +38 -0
  12. package/src/audio/help.html +193 -0
  13. package/src/audio/methods.js +38 -0
  14. package/src/audio/template.html +14 -0
  15. package/src/batch/help.html +97 -0
  16. package/src/batch/methods.js +39 -0
  17. package/src/batch/template.html +19 -0
  18. package/src/chat/help.html +436 -0
  19. package/src/chat/methods.js +82 -0
  20. package/src/chat/template.html +30 -0
  21. package/src/container-files/help.html +144 -0
  22. package/src/container-files/methods.js +60 -0
  23. package/src/container-files/template.html +7 -0
  24. package/src/containers/help.html +96 -0
  25. package/src/containers/methods.js +34 -0
  26. package/src/containers/template.html +6 -0
  27. package/src/embeddings/help.html +57 -0
  28. package/src/embeddings/methods.js +12 -0
  29. package/src/embeddings/template.html +6 -0
  30. package/src/files/help.html +102 -0
  31. package/src/files/methods.js +52 -0
  32. package/src/files/template.html +22 -0
  33. package/src/fine-tuning/help.html +187 -0
  34. package/src/fine-tuning/methods.js +68 -0
  35. package/src/fine-tuning/template.html +26 -0
  36. package/src/images/help.html +208 -0
  37. package/src/images/methods.js +38 -0
  38. package/src/images/template.html +14 -0
  39. package/src/lib.js +60 -0
  40. package/src/messages/help.html +194 -0
  41. package/src/messages/methods.js +61 -0
  42. package/src/messages/template.html +7 -0
  43. package/src/models/help.html +47 -0
  44. package/src/models/methods.js +30 -0
  45. package/src/models/template.html +14 -0
  46. package/src/moderations/help.html +31 -0
  47. package/src/moderations/methods.js +11 -0
  48. package/src/moderations/template.html +6 -0
  49. package/src/node.html +250 -0
  50. package/src/responses/help.html +248 -0
  51. package/src/responses/methods.js +55 -0
  52. package/src/responses/template.html +22 -0
  53. package/src/runs/help.html +563 -0
  54. package/src/runs/methods.js +157 -0
  55. package/src/runs/template.html +35 -0
  56. package/src/threads/help.html +88 -0
  57. package/src/threads/methods.js +39 -0
  58. package/src/threads/template.html +18 -0
  59. package/src/uploads/help.html +116 -0
  60. package/src/uploads/methods.js +121 -0
  61. package/src/uploads/template.html +21 -0
  62. package/src/vector-store-file-batches/help.html +156 -0
  63. package/src/vector-store-file-batches/methods.js +84 -0
  64. package/src/vector-store-file-batches/template.html +22 -0
  65. package/src/vector-store-files/help.html +133 -0
  66. package/src/vector-store-files/methods.js +53 -0
  67. package/src/vector-store-files/template.html +18 -0
  68. package/src/vector-stores/help.html +162 -0
  69. package/src/vector-stores/methods.js +48 -0
  70. package/src/vector-stores/template.html +7 -0
  71. package/locales/de-DE/node.json +0 -144
  72. package/locales/ja/node.json +0 -144
  73. package/locales/zh-CN/node.json +0 -144
package/node.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const lib = require("./lib.js");
2
+ const OpenaiApi = require("./lib.js");
3
3
 
4
4
  module.exports = function (RED) {
5
5
  class OpenaiApiNode {
@@ -15,11 +15,12 @@ module.exports = function (RED) {
15
15
  let clientApiBase = node.service.apiBase;
16
16
  let clientOrganization = node.service.organizationId;
17
17
 
18
- let client = new lib.OpenaiApi(
18
+ let client = new OpenaiApi(
19
19
  clientApiKey,
20
20
  clientApiBase,
21
21
  clientOrganization
22
22
  );
23
+
23
24
  let payload;
24
25
 
25
26
  const propertyType = node.config.propertyType || "msg";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inductiv/node-red-openai-api",
3
- "version": "1.87.3",
3
+ "version": "1.103.0-patch.1",
4
4
  "description": "Enhance your Node-RED projects with advanced AI capabilities.",
5
5
  "main": "node.js",
6
6
  "engines": {
@@ -29,13 +29,24 @@
29
29
  "ai agent",
30
30
  "low-code"
31
31
  ],
32
+ "scripts": {
33
+ "build:html": "gulp build-html",
34
+ "build:js": "esbuild src/lib.js --bundle --outfile=lib.js --format=cjs --platform=node",
35
+ "build": "npm run build:html && npm run build:js",
36
+ "prepare": "npm run build"
37
+ },
32
38
  "dependencies": {
33
- "openai": "~4.87.3"
39
+ "openai": "^4.103.0"
34
40
  },
35
41
  "author": "Allan Bunch",
36
42
  "license": "MIT",
37
43
  "repository": {
38
44
  "type": "git",
39
45
  "url": "git+https://github.com/allanbunch/node-red-openai-api.git"
46
+ },
47
+ "devDependencies": {
48
+ "esbuild": "^0.25.5",
49
+ "gulp": "^5.0.0",
50
+ "gulp-file-include": "^2.3.0"
40
51
  }
41
52
  }
@@ -0,0 +1,353 @@
1
+ <section>
2
+ <details>
3
+ <summary style="font-weight: bold;">🤖 Assistants</summary>
4
+ <a href="https://platform.openai.com/docs/api-reference/assistants" target="_blank">Official Documentation
5
+ <i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
6
+ <h4 style="font-weight: bolder;"> ⋙ Create Assistant</h4>
7
+ <p>Create an assistant with a model and instructions.</p>
8
+ <dl class="message-properties">
9
+ <h4>msg.payload Properties</h4>
10
+
11
+ <dt>
12
+ model
13
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-model"
14
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
15
+ <span class="property-type">string</span>
16
+ </dt>
17
+ <dd>ID of the model to use.</dd>
18
+ <dt class="optional">
19
+ name
20
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-name"
21
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
22
+ <span class="property-type">string</span>
23
+ </dt>
24
+ <dd>The name of the assistant.</dd>
25
+ <dt class="optional">
26
+ description
27
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-description"
28
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
29
+ <span class="property-type">string</span>
30
+ </dt>
31
+ <dd>The description of the assistant.</dd>
32
+ <dt class="optional">
33
+ instructions
34
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-instructions"
35
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
36
+ <span class="property-type">string</span>
37
+ </dt>
38
+ <dd>The system instructions that the assistant uses.</dd>
39
+ <dt class="optional">
40
+ tools
41
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-tools"
42
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
43
+ <span class="property-type">array</span>
44
+ </dt>
45
+ <dd>A list of tool enabled on the assistant.</dd>
46
+
47
+ <dt class="optional">
48
+ tool_resources
49
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-tool_resources"
50
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
51
+ <span class="property-type">object</span>
52
+ </dt>
53
+ <dd>A set of resources that are used by the assistant's tools. </dd>
54
+
55
+ <dt class="optional">
56
+ metadata
57
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-metadata"
58
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
59
+ <span class="property-type">object</span>
60
+ </dt>
61
+ <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
62
+
63
+ <dt class="optional">
64
+ temperature
65
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-temperature"
66
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
67
+ <span class="property-type">number</span>
68
+ </dt>
69
+ <dd>What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more
70
+ random, while lower values like 0.2 will make it more focused and deterministic.</dd>
71
+
72
+ <dt class="optional">
73
+ top_p
74
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-top_p"
75
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
76
+ <span class="property-type">number</span>
77
+ </dt>
78
+ <dd>An alternative to sampling with temperature, called nucleus sampling, where the model considers the
79
+ results of the tokens with top_p probability mass.</dd>
80
+
81
+ <dt class="optional">
82
+ response_format
83
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistant#assistants-createassistant-response_format"
84
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
85
+ <span class="property-type">string</span>
86
+ </dt>
87
+ <dd>Specifies the format that the model must output.</dd>
88
+
89
+ </dl>
90
+
91
+ <h4 style="font-weight: bolder;"> ⋙ Retrieve Assistant</h4>
92
+ <p>Retrieves an assistant.</p>
93
+ <dl class="message-properties">
94
+ <h4>msg.payload Properties</h4>
95
+
96
+ <dt>
97
+ assistant_id
98
+ <a href="https://platform.openai.com/docs/api-reference/assistants/getAssistant#assistants-getassistant-assistant_id"
99
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
100
+ <span class="property-type">string</span>
101
+ </dt>
102
+ <dd>The ID of the assistant to retrieve.</dd>
103
+ </dl>
104
+
105
+ <h4 style="font-weight: bolder;"> ⋙ Modify Assistant</h4>
106
+ <p>Modifies an assistant.</p>
107
+ <dl class="message-properties">
108
+ <h4>msg.payload Properties</h4>
109
+
110
+ <dt>
111
+ assistant_id
112
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-assistant_id"
113
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
114
+ <span class="property-type">string</span>
115
+ </dt>
116
+ <dd>The ID of the assistant to retrieve.</dd>
117
+
118
+ <dt class="optional">
119
+ model
120
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-model"
121
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
122
+ <span class="property-type">string</span>
123
+ </dt>
124
+ <dd>ID of the model to use.</dd>
125
+ <dt class="optional">
126
+ name
127
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-name"
128
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
129
+ <span class="property-type">string</span>
130
+ </dt>
131
+ <dd>The name of the assistant.</dd>
132
+ <dt class="optional">
133
+ description
134
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-description"
135
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
136
+ <span class="property-type">string</span>
137
+ </dt>
138
+ <dd>The description of the assistant.</dd>
139
+ <dt class="optional">
140
+ instructions
141
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-instructions"
142
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
143
+ <span class="property-type">string</span>
144
+ </dt>
145
+ <dd>The system instructions that the assistant uses.</dd>
146
+ <dt class="optional">
147
+ tools
148
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-tools"
149
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
150
+ <span class="property-type">array</span>
151
+ </dt>
152
+ <dd>A list of tool enabled on the assistant.</dd>
153
+
154
+ <dt class="optional">
155
+ tool_resources
156
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-tool_resources"
157
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
158
+ <span class="property-type">object</span>
159
+ </dt>
160
+ <dd>A set of resources that are used by the assistant's tools. </dd>
161
+
162
+ <dt class="optional">
163
+ metadata
164
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-metadata"
165
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
166
+ <span class="property-type">object</span>
167
+ </dt>
168
+ <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
169
+
170
+ <dt class="optional">
171
+ temperature
172
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-temperature"
173
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
174
+ <span class="property-type">number</span>
175
+ </dt>
176
+ <dd>What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more
177
+ random, while lower values like 0.2 will make it more focused and deterministic.</dd>
178
+
179
+ <dt class="optional">
180
+ top_p
181
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-top_p"
182
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
183
+ <span class="property-type">number</span>
184
+ </dt>
185
+ <dd>An alternative to sampling with temperature, called nucleus sampling, where the model considers the
186
+ results of the tokens with top_p probability mass.</dd>
187
+
188
+ <dt class="optional">
189
+ response_format
190
+ <a href="https://platform.openai.com/docs/api-reference/assistants/modifyAssistant#assistants-modifyassistant-response_format"
191
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
192
+ <span class="property-type">string</span>
193
+ </dt>
194
+ <dd>Specifies the format that the model must output.</dd>
195
+
196
+ </dl>
197
+
198
+ <h4 style="font-weight: bolder;"> ⋙ Delete Assistant</h4>
199
+ <p>Delete an assistant.</p>
200
+ <dl class="message-properties">
201
+ <h4>msg.payload Properties</h4>
202
+
203
+ <dt>
204
+ assistant_id
205
+ <a href="https://platform.openai.com/docs/api-reference/assistants/deleteAssistant#assistants-deleteassistant-assistant_id"
206
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
207
+ <span class="property-type">string</span>
208
+ </dt>
209
+ <dd>The ID of the assistant to delete.</dd>
210
+ </dl>
211
+
212
+ <h4 style="font-weight: bolder;"> ⋙ List Assistants</h4>
213
+ <p>Returns a list of assistants.</p>
214
+ <dl class="message-properties">
215
+ <h4>msg.payload Properties</h4>
216
+ <dt class="optional">
217
+ limit
218
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistants#assistants-listassistants-limit"
219
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
220
+ <span class="property-type">integer</span>
221
+ </dt>
222
+ <dd>A limit on the number of objects to be returned.</dd>
223
+ <dt class="optional">
224
+ order
225
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistants#assistants-listassistants-order"
226
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
227
+ <span class="property-type">string</span>
228
+ </dt>
229
+ <dd>Sort order by the created_at timestamp of the objects.</dd>
230
+ <dt class="optional">
231
+ after
232
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistants#assistants-listassistants-after"
233
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
234
+ <span class="property-type">string</span>
235
+ </dt>
236
+ <dd>A cursor for use in pagination.</dd>
237
+ <dt class="optional">
238
+ before
239
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistants#assistants-listassistants-before"
240
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
241
+ <span class="property-type">string</span>
242
+ </dt>
243
+ <dd>A cursor for use in pagination.</dd>
244
+ </dl>
245
+
246
+ <h4 style="font-weight: bolder;"> ⋙ List Assistant Files</h4>
247
+ <p>Returns a list of assistant files.</p>
248
+ <dl class="message-properties">
249
+ <h4>msg.payload Properties</h4>
250
+
251
+ <dt>
252
+ assistant_id
253
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistantFiles#assistants-listassistantfiles-assistant_id"
254
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
255
+ <span class="property-type">string</span>
256
+ </dt>
257
+ <dd>The ID of the assistant the file belongs to.</dd>
258
+ <dt class="optional">
259
+ limit
260
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistantFiles#assistants-listassistantfiles-limit"
261
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
262
+ <span class="property-type">integer</span>
263
+ </dt>
264
+ <dd>A limit on the number of objects to be returned.</dd>
265
+ <dt class="optional">
266
+ order
267
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistantFiles#assistants-listassistantfiles-order"
268
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
269
+ <span class="property-type">string</span>
270
+ </dt>
271
+ <dd>Sort order by the created_at timestamp of the objects.</dd>
272
+ <dt class="optional">
273
+ after
274
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistantFiles#assistants-listassistantfiles-after"
275
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
276
+ <span class="property-type">string</span>
277
+ </dt>
278
+ <dd>A cursor for use in pagination.</dd>
279
+ <dt class="optional">
280
+ before
281
+ <a href="https://platform.openai.com/docs/api-reference/assistants/listAssistantFiles#assistants-listassistantfiles-before"
282
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
283
+ <span class="property-type">string</span>
284
+ </dt>
285
+ <dd>A cursor for use in pagination.</dd>
286
+ </dl>
287
+
288
+ <h4 style="font-weight: bolder;"> ⋙ Create Assistant File</h4>
289
+ <p>Create an assistant file by attaching a file to an assistant.</p>
290
+ <dl class="message-properties">
291
+ <h4>msg.payload Properties</h4>
292
+
293
+ <dt>
294
+ assistant_id
295
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistantFile#assistants-createassistantfile-assistant_id"
296
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
297
+ <span class="property-type">string</span>
298
+ </dt>
299
+ <dd>The ID of the assistant for which to create a File.</dd>
300
+ <dt>
301
+ file_id
302
+ <a href="https://platform.openai.com/docs/api-reference/assistants/createAssistantFile#assistants-createassistantfile-file_id"
303
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
304
+ <span class="property-type">string</span>
305
+ </dt>
306
+ <dd>
307
+ A File ID (with purpose="assistants") that the assistant should use.
308
+ </dd>
309
+ </dl>
310
+
311
+ <h4 style="font-weight: bolder;"> ⋙ Retrieve Assistant File</h4>
312
+ <p>Retrieves an AssistantFile.</p>
313
+ <dl class="message-properties">
314
+ <h4>msg.payload Properties</h4>
315
+
316
+ <dt>
317
+ assistant_id
318
+ <a href="https://platform.openai.com/docs/api-reference/assistants/getAssistantFile#assistants-getassistantfile-assistant_id"
319
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
320
+ <span class="property-type">string</span>
321
+ </dt>
322
+ <dd>The ID of the assistant who the file belongs to.</dd>
323
+ <dt>
324
+ file_id
325
+ <a href="https://platform.openai.com/docs/api-reference/assistants/getAssistantFile#assistants-getassistantfile-file_id"
326
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
327
+ <span class="property-type">string</span>
328
+ </dt>
329
+ <dd>The ID of the file we're getting.</dd>
330
+ </dl>
331
+
332
+ <h4 style="font-weight: bolder;"> ⋙ Delete Assistant File</h4>
333
+ <p>Delete an assistant file.</p>
334
+ <dl class="message-properties">
335
+ <h4>msg.payload Properties</h4>
336
+
337
+ <dt>
338
+ assistant_id
339
+ <a href="https://platform.openai.com/docs/api-reference/assistants/deleteAssistantFile#assistants-deleteassistantfile-assistant_id"
340
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
341
+ <span class="property-type">string</span>
342
+ </dt>
343
+ <dd>The ID of the assistant that the file belongs to.</dd>
344
+ <dt>
345
+ file_id
346
+ <a href="https://platform.openai.com/docs/api-reference/assistants/deleteAssistantFile#assistants-deleteassistantfile-file_id"
347
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
348
+ <span class="property-type">string</span>
349
+ </dt>
350
+ <dd>The ID of the file to delete.</dd>
351
+ </dl>
352
+ </details>
353
+ </section>
@@ -0,0 +1,47 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function listAssistants(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+ const list = await openai.beta.assistants.list(parameters.payload);
6
+
7
+ return [...list.data];
8
+ }
9
+
10
+ async function createAssistant(parameters) {
11
+ const openai = new OpenAI(this.clientParams);
12
+ const response = await openai.beta.assistants.create(parameters.payload);
13
+
14
+ return response;
15
+ }
16
+
17
+ async function getAssistant(parameters) {
18
+ const openai = new OpenAI(this.clientParams);
19
+ const { assistant_id, ...params } = parameters.payload;
20
+ const response = await openai.beta.assistants.retrieve(assistant_id, params);
21
+
22
+ return response;
23
+ }
24
+
25
+ async function modifyAssistant(parameters) {
26
+ const openai = new OpenAI(this.clientParams);
27
+ const { assistant_id, ...params } = parameters.payload;
28
+ const response = await openai.beta.assistants.update(assistant_id, params);
29
+
30
+ return response;
31
+ }
32
+
33
+ async function deleteAssistant(parameters) {
34
+ const openai = new OpenAI(this.clientParams);
35
+ const { assistant_id, ...params } = parameters.payload;
36
+ const response = await openai.beta.assistants.del(assistant_id, params);
37
+
38
+ return response;
39
+ }
40
+
41
+ module.exports = {
42
+ listAssistants,
43
+ createAssistant,
44
+ getAssistant,
45
+ modifyAssistant,
46
+ deleteAssistant,
47
+ };
@@ -0,0 +1,38 @@
1
+ <optgroup style="font-style: normal;" label="🤖 Assistants (Beta)">
2
+ <option
3
+ value="createAssistant"
4
+ data-i18n="OpenaiApi.parameters.createAssistant"
5
+ ></option>
6
+ <option
7
+ value="getAssistant"
8
+ data-i18n="OpenaiApi.parameters.getAssistant"
9
+ ></option>
10
+ <option
11
+ value="modifyAssistant"
12
+ data-i18n="OpenaiApi.parameters.modifyAssistant"
13
+ ></option>
14
+ <option
15
+ value="deleteAssistant"
16
+ data-i18n="OpenaiApi.parameters.deleteAssistant"
17
+ ></option>
18
+ <option
19
+ value="listAssistants"
20
+ data-i18n="OpenaiApi.parameters.listAssistants"
21
+ ></option>
22
+ <option
23
+ value="listAssistantFiles"
24
+ data-i18n="OpenaiApi.parameters.listAssistantFiles"
25
+ ></option>
26
+ <option
27
+ value="createAssistantFile"
28
+ data-i18n="OpenaiApi.parameters.createAssistantFile"
29
+ ></option>
30
+ <option
31
+ value="getAssistantFile"
32
+ data-i18n="OpenaiApi.parameters.getAssistantFile"
33
+ ></option>
34
+ <option
35
+ value="deleteAssistantFile"
36
+ data-i18n="OpenaiApi.parameters.deleteAssistantFile"
37
+ ></option>
38
+ </optgroup>