@inductiv/node-red-openai-api 1.89.0 → 1.103.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.
Files changed (73) hide show
  1. package/README.md +11 -15
  2. package/examples/responses/mcp.json +87 -0
  3. package/gulpfile.js +15 -0
  4. package/lib.js +16375 -539
  5. package/locales/en-US/node.json +9 -0
  6. package/node.html +3037 -3839
  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 +58 -0
  40. package/src/messages/help.html +174 -0
  41. package/src/messages/methods.js +48 -0
  42. package/src/messages/template.html +18 -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 +59 -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 +54 -0
  70. package/src/vector-stores/template.html +22 -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
@@ -0,0 +1,174 @@
1
+ <section>
2
+ <details>
3
+ <summary style="font-weight: bold;">📟 Messages</summary>
4
+ <a href="https://platform.openai.com/docs/api-reference/messages" target="_blank">Official Documentation
5
+ <i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
6
+ <h4 style="font-weight: bolder;"> ⋙ List Messages</h4>
7
+ <p>Returns a list of messages for a given thread.</p>
8
+ <dl class="message-properties">
9
+ <h4>msg.payload Properties</h4>
10
+
11
+ <dt>
12
+ thread_id
13
+ <a href="https://platform.openai.com/docs/api-reference/messages/listMessages#messages-listmessages-thread_id"
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>The ID of the thread the messages belong to.</dd>
18
+ <dt class="optional">
19
+ limit
20
+ <a href="https://platform.openai.com/docs/api-reference/messages/listMessages#messages-listmessages-limit"
21
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
22
+ <span class="property-type">integer</span>
23
+ </dt>
24
+ <dd>
25
+ A limit on the number of objects to be returned. Limit can range between
26
+ 1 and 100, and the default is 20.
27
+ </dd>
28
+ <dt class="optional">
29
+ order
30
+ <a href="https://platform.openai.com/docs/api-reference/messages/listMessages#messages-listmessages-order"
31
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
32
+ <span class="property-type">string</span>
33
+ </dt>
34
+ <dd>Sort order by the created_at timestamp of the objects.</dd>
35
+ <dt class="optional">
36
+ after
37
+ <a href="https://platform.openai.com/docs/api-reference/messages/listMessages#messages-listmessages-after"
38
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
39
+ <span class="property-type">string</span>
40
+ </dt>
41
+ <dd>A cursor for use in pagination.</dd>
42
+ <dt class="optional">
43
+ before
44
+ <a href="https://platform.openai.com/docs/api-reference/messages/listMessages#messages-listmessages-before"
45
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
46
+ <span class="property-type">string</span>
47
+ </dt>
48
+ <dd>A cursor for use in pagination.</dd>
49
+
50
+ <dt class="optional">
51
+ run_id
52
+ <a href="https://platform.openai.com/docs/api-reference/messages/listMessages#messages-listmessages-run_id"
53
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
54
+ <span class="property-type">string</span>
55
+ </dt>
56
+ <dd>Filter messages by the run ID that generated them.</dd>
57
+
58
+ </dl>
59
+
60
+ <h4 style="font-weight: bolder;"> ⋙ Create Message</h4>
61
+ <p>Create a message.</p>
62
+ <dl class="message-properties">
63
+ <h4>msg.payload Properties</h4>
64
+
65
+ <dt>
66
+ thread_id
67
+ <a href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-thread_id"
68
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
69
+ <span class="property-type">string</span>
70
+ </dt>
71
+ <dd>The ID of the thread to create a message for.</dd>
72
+ <dt>
73
+ role
74
+ <a href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-role"
75
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
76
+ <span class="property-type">string</span>
77
+ </dt>
78
+ <dd>The role of the entity that is creating the message.</dd>
79
+ <dt>
80
+ content
81
+ <a href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-content"
82
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
83
+ <span class="property-type">string</span>
84
+ </dt>
85
+ <dd>The content of the message.</dd>
86
+ <dt class="optional">
87
+ attachments
88
+ <a href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-attachments"
89
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
90
+ <span class="property-type">array</span>
91
+ </dt>
92
+ <dd>A list of files attached to the message, and the tools they should be added to.</dd>
93
+ <dt class="optional">
94
+ metadata
95
+ <a href="https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-metadata"
96
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
97
+ <span class="property-type">object</span>
98
+ </dt>
99
+ <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
100
+ </dl>
101
+
102
+ <h4 style="font-weight: bolder;"> ⋙ Delete Message</h4>
103
+ <p>Deletes a message.</p>
104
+ <dl class="message-properties">
105
+ <h4>msg.payload Properties</h4>
106
+
107
+ <dt>
108
+ thread_id
109
+ <a href="https://platform.openai.com/docs/api-reference/messages/deleteMessage#messages-deletemessage-thread_id"
110
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
111
+ <span class="property-type">string</span>
112
+ </dt>
113
+ <dd>The ID of the thread to which this message belongs.</dd>
114
+ <dt>
115
+ message_id
116
+ <a href="https://platform.openai.com/docs/api-reference/messages/deleteMessage#messages-deletemessage-message_id"
117
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
118
+ <span class="property-type">string</span>
119
+ </dt>
120
+ <dd>The ID of the message to delete.</dd>
121
+ </dl>
122
+
123
+ <h4 style="font-weight: bolder;"> ⋙ Retrieve Message</h4>
124
+ <p>Retrieve a message.</p>
125
+ <dl class="message-properties">
126
+ <h4>msg.payload Properties</h4>
127
+
128
+ <dt>
129
+ thread_id
130
+ <a href="https://platform.openai.com/docs/api-reference/messages/getMessage#messages-getmessage-thread_id"
131
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
132
+ <span class="property-type">string</span>
133
+ </dt>
134
+ <dd>The ID of the thread to which this message belongs.</dd>
135
+ <dt>
136
+ message_id
137
+ <a href="https://platform.openai.com/docs/api-reference/messages/getMessage#messages-getmessage-message_id"
138
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
139
+ <span class="property-type">string</span>
140
+ </dt>
141
+ <dd>The ID of the message to retrieve.</dd>
142
+ </dl>
143
+
144
+ <h4 style="font-weight: bolder;"> ⋙ Modify Message</h4>
145
+ <p>Modifies a message.</p>
146
+ <dl class="message-properties">
147
+ <h4>msg.payload Properties</h4>
148
+
149
+ <dt>
150
+ thread_id
151
+ <a href="https://platform.openai.com/docs/api-reference/messages/modifyMessage#messages-modifymessage-thread_id"
152
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
153
+ <span class="property-type">string</span>
154
+ </dt>
155
+ <dd>The ID of the thread to which this message belongs.</dd>
156
+ <dt>
157
+ message_id
158
+ <a href="https://platform.openai.com/docs/api-reference/messages/modifyMessage#messages-modifymessage-message_id"
159
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
160
+ <span class="property-type">string</span>
161
+ </dt>
162
+ <dd>The ID of the message to modify.</dd>
163
+ <dt class="optional">
164
+ metadata
165
+ <a href="https://platform.openai.com/docs/api-reference/messages/modifyMessage#messages-modifymessage-metadata"
166
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
167
+ <span class="property-type">object</span>
168
+ </dt>
169
+ <dd>Set of 16 key-value pairs that can be attached to an object.</dd>
170
+ </dl>
171
+
172
+
173
+ </details>
174
+ </section>
@@ -0,0 +1,48 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function listMessages(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+ const { thread_id, ...params } = parameters.payload;
6
+ const list = await openai.beta.threads.messages.list(thread_id, params);
7
+
8
+ return [...list.data];
9
+ }
10
+
11
+ async function createMessage(parameters) {
12
+ const openai = new OpenAI(this.clientParams);
13
+ const { thread_id, ...params } = parameters.payload;
14
+ const response = await openai.beta.threads.messages.create(thread_id, params);
15
+
16
+ return response;
17
+ }
18
+
19
+ async function getMessage(parameters) {
20
+ const openai = new OpenAI(this.clientParams);
21
+ const { thread_id, message_id, ...params } = parameters.payload;
22
+ const response = await openai.beta.threads.messages.retrieve(
23
+ thread_id,
24
+ message_id,
25
+ params
26
+ );
27
+
28
+ return response;
29
+ }
30
+
31
+ async function modifyMessage(parameters) {
32
+ const openai = new OpenAI(this.clientParams);
33
+ const { thread_id, message_id, ...params } = parameters.payload;
34
+ const response = await openai.beta.threads.messages.update(
35
+ thread_id,
36
+ message_id,
37
+ params
38
+ );
39
+
40
+ return response;
41
+ }
42
+
43
+ module.exports = {
44
+ listMessages,
45
+ createMessage,
46
+ getMessage,
47
+ modifyMessage,
48
+ };
@@ -0,0 +1,18 @@
1
+ <optgroup style="font-style: normal;" label="📟 Messages (Beta)">
2
+ <option
3
+ value="listMessages"
4
+ data-i18n="OpenaiApi.parameters.listMessages"
5
+ ></option>
6
+ <option
7
+ value="createMessage"
8
+ data-i18n="OpenaiApi.parameters.createMessage"
9
+ ></option>
10
+ <option
11
+ value="getMessage"
12
+ data-i18n="OpenaiApi.parameters.getMessage"
13
+ ></option>
14
+ <option
15
+ value="modifyMessage"
16
+ data-i18n="OpenaiApi.parameters.modifyMessage"
17
+ ></option>
18
+ </optgroup>
@@ -0,0 +1,47 @@
1
+ <section>
2
+ <details>
3
+ <summary style="font-weight: bold;">🧠 Models</summary>
4
+ <a href="https://platform.openai.com/docs/api-reference/models" target="_blank">Official Documentation
5
+ <i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
6
+ <h4 style="font-weight: bolder;"> ⋙ List Models</h4>
7
+ <p>
8
+ Lists the currently available models, and provides basic information about
9
+ each one such as the owner and availability.
10
+ </p>
11
+ <dl class="message-properties"></dl>
12
+
13
+ <h4 style="font-weight: bolder;"> ⋙ Retrieve Model</h4>
14
+ <p>
15
+ Retrieves a model instance, providing basic information about the model
16
+ such as the owner and permissioning.
17
+ </p>
18
+ <dl class="message-properties">
19
+ <h4>msg.payload Properties</h4>
20
+
21
+ <dt>
22
+ model
23
+ <a href="https://platform.openai.com/docs/api-reference/models/retrieve#models-retrieve-model"
24
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
25
+ <span class="property-type">string</span>
26
+ </dt>
27
+ <dd>The ID of the model to use for this request</dd>
28
+ </dl>
29
+
30
+ <h4 style="font-weight: bolder;"> ⋙ Delete Fine-tuned Model</h4>
31
+ <p>
32
+ Delete a fine-tuned model. You must have the Owner role in your
33
+ organization to delete a model.
34
+ </p>
35
+ <dl class="message-properties">
36
+ <h4>msg.payload Properties</h4>
37
+
38
+ <dt>
39
+ model
40
+ <a href="https://platform.openai.com/docs/api-reference/models/delete#models-delete-model"
41
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
42
+ <span class="property-type">string</span>
43
+ </dt>
44
+ <dd>The model to delete</dd>
45
+ </dl>
46
+ </details>
47
+ </section>
@@ -0,0 +1,30 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function listModels(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+ const list = await openai.models.list(parameters.payload);
6
+
7
+ return [...list.data];
8
+ }
9
+
10
+ async function retrieveModel(parameters) {
11
+ const openai = new OpenAI(this.clientParams);
12
+ const model = parameters.payload.model;
13
+ const response = await openai.models.retrieve(model);
14
+
15
+ return response;
16
+ }
17
+
18
+ async function deleteModel(parameters) {
19
+ const openai = new OpenAI(this.clientParams);
20
+ const model = parameters.payload.model;
21
+ const response = await openai.models.del(model);
22
+
23
+ return response;
24
+ }
25
+
26
+ module.exports = {
27
+ listModels,
28
+ retrieveModel,
29
+ deleteModel,
30
+ };
@@ -0,0 +1,14 @@
1
+ <optgroup style="font-style: normal;" label="🧠 Models">
2
+ <option
3
+ value="listModels"
4
+ data-i18n="OpenaiApi.parameters.listModels"
5
+ ></option>
6
+ <option
7
+ value="retrieveModel"
8
+ data-i18n="OpenaiApi.parameters.retrieveModel"
9
+ ></option>
10
+ <option
11
+ value="deleteModel"
12
+ data-i18n="OpenaiApi.parameters.deleteModel"
13
+ ></option>
14
+ </optgroup>
@@ -0,0 +1,31 @@
1
+ <section>
2
+ <details>
3
+ <summary style="font-weight: bold;">✅ Moderations</summary>
4
+ <a href="https://platform.openai.com/docs/api-reference/moderations" 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 Moderation</h4>
7
+ <p>Classifies if text violates OpenAI's Content Policy</p>
8
+ <dl class="message-properties">
9
+ <h4>msg.payload Properties</h4>
10
+
11
+ <dt>
12
+ input
13
+ <a href="https://platform.openai.com/docs/api-reference/moderations/create#moderations-create-input"
14
+ target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
15
+ <span class="property-type">string | array</span>
16
+ </dt>
17
+ <dd>The input text to classify</dd>
18
+ <dt class="optional">
19
+ model
20
+ <a href="https://platform.openai.com/docs/api-reference/moderations/create#moderations-create-model"
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>
25
+ Two content moderations models are available: text-moderation-stable
26
+ and text-moderation-latest.
27
+ </dd>
28
+ </dl>
29
+
30
+ </details>
31
+ </section>
@@ -0,0 +1,11 @@
1
+ const OpenAI = require("openai").OpenAI;
2
+
3
+ async function createModeration(parameters) {
4
+ const openai = new OpenAI(this.clientParams);
5
+ const response = await openai.moderations.create(parameters.payload);
6
+ return response;
7
+ }
8
+
9
+ module.exports = {
10
+ createModeration,
11
+ };
@@ -0,0 +1,6 @@
1
+ <optgroup style="font-style: normal;" label="✅ Moderations">
2
+ <option
3
+ value="createModeration"
4
+ data-i18n="OpenaiApi.parameters.createModeration"
5
+ ></option>
6
+ </optgroup>
package/src/node.html ADDED
@@ -0,0 +1,250 @@
1
+ <script type="text/javascript">
2
+ RED.nodes.registerType("OpenAI API", {
3
+ category: "AI",
4
+ color: "#B8B1FB",
5
+ defaults: {
6
+ name: { value: "" },
7
+ property: { value: "payload", required: true },
8
+ propertyType: { value: "msg" },
9
+ service: { value: "", type: "Service Host", required: true },
10
+ method: { value: "", required: true },
11
+ },
12
+ inputs: 1,
13
+ outputs: 1,
14
+ icon: "icon.png",
15
+ label: function () {
16
+ return this.name || this.method || "OpenAI API";
17
+ },
18
+ labelStyle: function () {
19
+ return this.name ? "node_label_italic" : "";
20
+ },
21
+ oneditprepare: function () {
22
+ var selectedMethod = $("#node-input-method option:selected");
23
+ if (!selectedMethod.val()) {
24
+ var methods = $("#node-input-method").children();
25
+ var firstMethod = methods.first();
26
+ $("#node-input-method").val(firstMethod.val());
27
+ };
28
+
29
+ // set the default property type value to "payload"
30
+ if (this.property === undefined) {
31
+ $("#node-input-property").val("payload");
32
+ }
33
+
34
+ $("#node-input-property").typedInput({
35
+ default: "msg",
36
+ value: "payload",
37
+ types: ["msg", "flow", "global"],
38
+ typeField: "#node-input-propertyType"
39
+ })
40
+ }
41
+ });
42
+ </script>
43
+
44
+ <script type="text/html" data-template-name="OpenAI API">
45
+ <div class="form-row">
46
+ <label for="node-input-name"
47
+ ><i class="fa fa-tag"></i>
48
+ <span data-i18n="node-red:common.label.name"></span
49
+ ></label>
50
+ <input
51
+ type="text"
52
+ id="node-input-name"
53
+ data-i18n="[placeholder]node-red:common.label.name"
54
+ />
55
+ </div>
56
+ <hr />
57
+
58
+ <div class="form-row">
59
+ <label for="node-input-service"
60
+ ><i class="fa fa-cloud"></i>
61
+ <span data-i18n="OpenaiApi.label.serviceHost"></span
62
+ ></label>
63
+ <input type="text" id="node-input-service" />
64
+ </div>
65
+
66
+ <div class="form-row">
67
+ <label for="node-input-property"
68
+ ><i class="fa fa-ellipsis-h"></i>
69
+ <span data-i18n="OpenaiApi.label.property"></span
70
+ ></label>
71
+ <input type="text" id="node-input-property">
72
+ <input type="hidden" id="node-input-propertyType">
73
+ </div>
74
+
75
+ <div class="form-row">
76
+ <label for="node-input-method"
77
+ ><i class="fa fa-tasks"></i>
78
+ <span data-i18n="OpenaiApi.label.method"></span
79
+ ></label>
80
+ <select id="node-input-method">
81
+ @@include('./assistants/template.html')
82
+ @@include('./audio/template.html')
83
+ @@include('./batch/template.html')
84
+ @@include('./chat/template.html')
85
+ @@include('./container-files/template.html')
86
+ @@include('./containers/template.html')
87
+ @@include('./embeddings/template.html')
88
+ @@include('./files/template.html')
89
+ @@include('./fine-tuning/template.html')
90
+ @@include('./images/template.html')
91
+ @@include('./messages/template.html')
92
+ @@include('./models/template.html')
93
+ @@include('./moderations/template.html')
94
+ @@include('./responses/template.html')
95
+ @@include('./runs/template.html')
96
+ @@include('./threads/template.html')
97
+ @@include('./uploads/template.html')
98
+ @@include('./vector-stores/template.html')
99
+ @@include('./vector-store-files/template.html')
100
+ @@include('./vector-store-file-batches/template.html')
101
+ </select>
102
+ </div>
103
+ </script>
104
+
105
+ <script type="text/html" data-help-name="OpenAI API">
106
+ <p>
107
+ OpenAI Platform Services API. Please see the
108
+ <a href="https://platform.openai.com/docs/api-reference" target="_blank"
109
+ >OpenAI API Reference</a
110
+ >
111
+ for more details.
112
+ </p>
113
+ <p><b>Reference</b></p>
114
+
115
+ @@include('./assistants/help.html')
116
+ @@include('./audio/help.html')
117
+ @@include('./batch/help.html')
118
+ @@include('./chat/help.html')
119
+ @@include('./container-files/help.html')
120
+ @@include('./containers/help.html')
121
+ @@include('./embeddings/help.html')
122
+ @@include('./files/help.html')
123
+ @@include('./fine-tuning/help.html')
124
+ @@include('./images/help.html')
125
+ @@include('./messages/help.html')
126
+ @@include('./models/help.html')
127
+ @@include('./moderations/help.html')
128
+ @@include('./responses/help.html')
129
+ @@include('./runs/help.html')
130
+ @@include('./threads/help.html')
131
+ @@include('./uploads/help.html')
132
+ @@include('./vector-stores/help.html')
133
+ @@include('./vector-store-files/help.html')
134
+ @@include('./vector-store-file-batches/help.html')
135
+ </script>
136
+
137
+ <script type="text/javascript">
138
+ RED.nodes.registerType("Service Host", {
139
+ category: "config",
140
+ defaults: {
141
+ apiBase: { value: "https://api.openai.com/v1", required: true },
142
+ secureApiKeyHeaderOrQueryName: { value: "Authorization" },
143
+ organizationId: { value: "" },
144
+ secureApiKeyIsQuery: { value: false },
145
+ name: { value: "" },
146
+ },
147
+ credentials: {
148
+ secureApiKeyValue: { type: "password" },
149
+ temp: { type: "text" },
150
+ },
151
+ label: function () {
152
+ return this.name || this.host;
153
+ },
154
+ labelStyle: function () {
155
+ return this.name ? "node_label_italic" : "";
156
+ },
157
+ oneditprepare: function () {
158
+ $("#node-config-input-secureApiKeyIsQuery-label").hide();
159
+ $("#node-config-input-secureApiKeyIsQuery").hide();
160
+ var selected = $(
161
+ "#node-config-input-secureApiKeyIsQuery option:selected",
162
+ );
163
+ if (!selected.val()) {
164
+ $("#node-config-input-secureApiKeyIsQuery").val(false);
165
+ };
166
+ },
167
+ });
168
+ </script>
169
+
170
+ <script type="text/html" data-template-name="Service Host">
171
+ <div class="form-row">
172
+ <label id="node-config-input-apiBase-label" for="node-config-input-apiBase"
173
+ ><i class="fa fa-list"></i>
174
+ <span data-i18n="OpenaiApi.label.apiBase"></span
175
+ ></label>
176
+ <input
177
+ type="text"
178
+ id="node-config-input-apiBase"
179
+ placeholder="https://api.openai.com/v1"
180
+ />
181
+ </div>
182
+ <div class="form-row">
183
+ <label
184
+ id="node-config-input-secureApiKeyHeaderOrQueryName-label"
185
+ for="node-config-input-secureApiKeyHeaderOrQueryName"
186
+ ><i class="fa fa-list"></i>
187
+ <span data-i18n="OpenaiApi.label.header"></span
188
+ ></label>
189
+ <input
190
+ type="text"
191
+ id="node-config-input-secureApiKeyHeaderOrQueryName"
192
+ placeholder=""
193
+ />
194
+ </div>
195
+ <div class="form-row">
196
+ <label
197
+ id="node-config-input-secureApiKeyValue-label"
198
+ for="node-config-input-secureApiKeyValue"
199
+ ><i class="fa fa-lock"></i>
200
+ <span data-i18n="OpenaiApi.label.apiKey"></span
201
+ ></label>
202
+ <input
203
+ type="password"
204
+ id="node-config-input-secureApiKeyValue"
205
+ placeholder=""
206
+ />
207
+ </div>
208
+ <div class="form-row">
209
+ <label
210
+ id="node-config-input-organizationId-label"
211
+ for="node-config-input-organizationId"
212
+ ><i class="fa fa-list"></i>
213
+ <span data-i18n="OpenaiApi.label.organizationId"></span
214
+ ></label>
215
+ <input
216
+ type="text"
217
+ id="node-config-input-organizationId"
218
+ placeholder="OpenAI Organization Id"
219
+ />
220
+ </div>
221
+ <div class="form-row">
222
+ <label
223
+ id="node-config-input-secureApiKeyIsQuery-label"
224
+ for="node-config-input-secureApiKeyIsQuery"
225
+ ><i class="fa fa-dot-circle-o"></i>
226
+ <span data-i18n="OpenaiApi.label.isQuery"></span
227
+ ></label>
228
+ <select id="node-config-input-secureApiKeyIsQuery">
229
+ <option value="true">true</option>
230
+ <option value="false">false</option>
231
+ </select>
232
+ </div>
233
+
234
+ <div class="form-row">
235
+ <label for="node-config-input-name"
236
+ ><i class="fa fa-tag"></i>
237
+ <span data-i18n="node-red:common.label.name"></span
238
+ ></label>
239
+ <input
240
+ type="text"
241
+ id="node-config-input-name"
242
+ data-i18n="[placeholder]node-red:common.label.name"
243
+ />
244
+ </div>
245
+ </script>
246
+
247
+ <script type="text/html" data-help-name="Service Host">
248
+ <p><b>Header</b>: Variable name to set API key</p>
249
+ <p><b>Value</b>: Value of API key</p>
250
+ </script>