@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.
- package/README.md +20 -40
- package/examples/responses/mcp.json +87 -0
- package/gulpfile.js +15 -0
- package/lib.js +16420 -538
- package/locales/en-US/node.json +10 -0
- package/node.html +3050 -3842
- package/node.js +3 -2
- package/package.json +13 -2
- package/src/assistants/help.html +353 -0
- package/src/assistants/methods.js +47 -0
- package/src/assistants/template.html +38 -0
- package/src/audio/help.html +193 -0
- package/src/audio/methods.js +38 -0
- package/src/audio/template.html +14 -0
- package/src/batch/help.html +97 -0
- package/src/batch/methods.js +39 -0
- package/src/batch/template.html +19 -0
- package/src/chat/help.html +436 -0
- package/src/chat/methods.js +82 -0
- package/src/chat/template.html +30 -0
- package/src/container-files/help.html +144 -0
- package/src/container-files/methods.js +60 -0
- package/src/container-files/template.html +7 -0
- package/src/containers/help.html +96 -0
- package/src/containers/methods.js +34 -0
- package/src/containers/template.html +6 -0
- package/src/embeddings/help.html +57 -0
- package/src/embeddings/methods.js +12 -0
- package/src/embeddings/template.html +6 -0
- package/src/files/help.html +102 -0
- package/src/files/methods.js +52 -0
- package/src/files/template.html +22 -0
- package/src/fine-tuning/help.html +187 -0
- package/src/fine-tuning/methods.js +68 -0
- package/src/fine-tuning/template.html +26 -0
- package/src/images/help.html +208 -0
- package/src/images/methods.js +38 -0
- package/src/images/template.html +14 -0
- package/src/lib.js +60 -0
- package/src/messages/help.html +194 -0
- package/src/messages/methods.js +61 -0
- package/src/messages/template.html +7 -0
- package/src/models/help.html +47 -0
- package/src/models/methods.js +30 -0
- package/src/models/template.html +14 -0
- package/src/moderations/help.html +31 -0
- package/src/moderations/methods.js +11 -0
- package/src/moderations/template.html +6 -0
- package/src/node.html +250 -0
- package/src/responses/help.html +248 -0
- package/src/responses/methods.js +55 -0
- package/src/responses/template.html +22 -0
- package/src/runs/help.html +563 -0
- package/src/runs/methods.js +157 -0
- package/src/runs/template.html +35 -0
- package/src/threads/help.html +88 -0
- package/src/threads/methods.js +39 -0
- package/src/threads/template.html +18 -0
- package/src/uploads/help.html +116 -0
- package/src/uploads/methods.js +121 -0
- package/src/uploads/template.html +21 -0
- package/src/vector-store-file-batches/help.html +156 -0
- package/src/vector-store-file-batches/methods.js +84 -0
- package/src/vector-store-file-batches/template.html +22 -0
- package/src/vector-store-files/help.html +133 -0
- package/src/vector-store-files/methods.js +53 -0
- package/src/vector-store-files/template.html +18 -0
- package/src/vector-stores/help.html +162 -0
- package/src/vector-stores/methods.js +48 -0
- package/src/vector-stores/template.html +7 -0
- package/locales/de-DE/node.json +0 -144
- package/locales/ja/node.json +0 -144
- package/locales/zh-CN/node.json +0 -144
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🗨️ Responses</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/responses" 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 Model Response</h4>
|
|
7
|
+
<p>Creates a model response.</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/responses/create#responses-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>Text, image, or file inputs to the model, used to generate a response.</dd>
|
|
18
|
+
|
|
19
|
+
<dt>
|
|
20
|
+
model
|
|
21
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-model"
|
|
22
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
23
|
+
<span class="property-type">string</span>
|
|
24
|
+
</dt>
|
|
25
|
+
<dd>Model ID used to generate the response.</dd>
|
|
26
|
+
|
|
27
|
+
<dt class="optional">
|
|
28
|
+
include
|
|
29
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-include"
|
|
30
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
31
|
+
<span class="property-type">array</span>
|
|
32
|
+
</dt>
|
|
33
|
+
<dd>Specify additional output data to include in the model response.</dd>
|
|
34
|
+
|
|
35
|
+
<dt class="optional">
|
|
36
|
+
instructions
|
|
37
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-instructions"
|
|
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>Inserts a system (or developer) message as the first item in the model's context.</dd>
|
|
42
|
+
|
|
43
|
+
<dt class="optional">
|
|
44
|
+
max_output_tokens
|
|
45
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-max_output_tokens"
|
|
46
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
47
|
+
<span class="property-type">integer</span>
|
|
48
|
+
</dt>
|
|
49
|
+
<dd>An upper bound for the number of tokens that can be generated for a response.</dd>
|
|
50
|
+
|
|
51
|
+
<dt class="optional">
|
|
52
|
+
metadata
|
|
53
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-metadata"
|
|
54
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
55
|
+
<span class="property-type">object</span>
|
|
56
|
+
</dt>
|
|
57
|
+
<dd>Set of 16 key-value pairs that can be attached to an object.</dd>
|
|
58
|
+
|
|
59
|
+
<dt class="optional">
|
|
60
|
+
parallel_tool_calls
|
|
61
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-parallel_tool_calls"
|
|
62
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
63
|
+
<span class="property-type">boolean</span>
|
|
64
|
+
</dt>
|
|
65
|
+
<dd>Whether to allow the model to run tool calls in parallel.</dd>
|
|
66
|
+
|
|
67
|
+
<dt class="optional">
|
|
68
|
+
parallel_tool_calls
|
|
69
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-parallel_tool_calls"
|
|
70
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
71
|
+
<span class="property-type">boolean</span>
|
|
72
|
+
</dt>
|
|
73
|
+
<dd>Whether to allow the model to run tool calls in parallel.</dd>
|
|
74
|
+
|
|
75
|
+
<dt class="optional">
|
|
76
|
+
previous_response_id
|
|
77
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-previous_response_id"
|
|
78
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
79
|
+
<span class="property-type">string</span>
|
|
80
|
+
</dt>
|
|
81
|
+
<dd>The unique ID of the previous response to the model.</dd>
|
|
82
|
+
|
|
83
|
+
<dt class="optional">
|
|
84
|
+
reasoning
|
|
85
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-reasoning"
|
|
86
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
87
|
+
<span class="property-type">object</span>
|
|
88
|
+
</dt>
|
|
89
|
+
<dd>o-series models only. See official docs for option properties.</dd>
|
|
90
|
+
|
|
91
|
+
<dt class="optional">
|
|
92
|
+
store
|
|
93
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-store"
|
|
94
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
95
|
+
<span class="property-type">boolean</span>
|
|
96
|
+
</dt>
|
|
97
|
+
<dd>Whether to store the generated model response for later retrieval via API.</dd>
|
|
98
|
+
|
|
99
|
+
<dt class="optional">
|
|
100
|
+
stream
|
|
101
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-stream"
|
|
102
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
103
|
+
<span class="property-type">boolean</span>
|
|
104
|
+
</dt>
|
|
105
|
+
<dd>If set to true, the model response data will be streamed to the client as it is generated using
|
|
106
|
+
server-sent events.</dd>
|
|
107
|
+
|
|
108
|
+
<dt class="optional">
|
|
109
|
+
temperature
|
|
110
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-temperature"
|
|
111
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
112
|
+
<span class="property-type">number</span>
|
|
113
|
+
</dt>
|
|
114
|
+
<dd>What sampling temperature to use, between 0 and 2.</dd>
|
|
115
|
+
|
|
116
|
+
<dt class="optional">
|
|
117
|
+
text
|
|
118
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-text"
|
|
119
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
120
|
+
<span class="property-type">object</span>
|
|
121
|
+
</dt>
|
|
122
|
+
<dd>Configuration options for a text response from the model.</dd>
|
|
123
|
+
|
|
124
|
+
<dt class="optional">
|
|
125
|
+
tool_choice
|
|
126
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-tool_choice"
|
|
127
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
128
|
+
<span class="property-type">string or object</span>
|
|
129
|
+
</dt>
|
|
130
|
+
<dd>How the model should select which tool (or tools) to use when generating a response.</dd>
|
|
131
|
+
|
|
132
|
+
<dt class="optional">
|
|
133
|
+
tools
|
|
134
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-tools"
|
|
135
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
136
|
+
<span class="property-type">array</span>
|
|
137
|
+
</dt>
|
|
138
|
+
<dd>
|
|
139
|
+
An array of tools the model may call while generating a response.
|
|
140
|
+
For Model Context Protocol (MCP) tools, each object in the array should follow <a
|
|
141
|
+
href="https://platform.openai.com/docs/guides/tools-remote-mcp?lang=javascript&utm_source==%40inductiv%2Fnode-red-openai-api"
|
|
142
|
+
target="_blank">this
|
|
143
|
+
structure</a>.
|
|
144
|
+
</dd>
|
|
145
|
+
|
|
146
|
+
<dt class="optional">
|
|
147
|
+
top_p
|
|
148
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-top_p"
|
|
149
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
150
|
+
<span class="property-type">number</span>
|
|
151
|
+
</dt>
|
|
152
|
+
<dd>An alternative to sampling with temperature, called nucleus sampling.</dd>
|
|
153
|
+
|
|
154
|
+
<dt class="optional">
|
|
155
|
+
truncation
|
|
156
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-truncation"
|
|
157
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
158
|
+
<span class="property-type">string</span>
|
|
159
|
+
</dt>
|
|
160
|
+
<dd>The truncation strategy to use for the model response.</dd>
|
|
161
|
+
|
|
162
|
+
<dt class="optional">
|
|
163
|
+
user
|
|
164
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/create#responses-create-user"
|
|
165
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
166
|
+
<span class="property-type">string</span>
|
|
167
|
+
</dt>
|
|
168
|
+
<dd>A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.</dd>
|
|
169
|
+
|
|
170
|
+
</dl>
|
|
171
|
+
|
|
172
|
+
<h4 style="font-weight: bolder;"> ⋙ Get Model Response</h4>
|
|
173
|
+
<p>Retrieves a model response with the given ID.</p>
|
|
174
|
+
<dl class="message-properties">
|
|
175
|
+
<h4>msg.payload Properties</h4>
|
|
176
|
+
|
|
177
|
+
<dt>
|
|
178
|
+
response_id
|
|
179
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/get#responses-get-response_id"
|
|
180
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
181
|
+
<span class="property-type">string</span>
|
|
182
|
+
</dt>
|
|
183
|
+
<dd>The ID of the response to retrieve.</dd>
|
|
184
|
+
</dl>
|
|
185
|
+
|
|
186
|
+
<h4 style="font-weight: bolder;"> ⋙ Delete Model Response</h4>
|
|
187
|
+
<p>Deletes a model response with the given ID.</p>
|
|
188
|
+
<dl class="message-properties">
|
|
189
|
+
<h4>msg.payload Properties</h4>
|
|
190
|
+
|
|
191
|
+
<dt>
|
|
192
|
+
response_id
|
|
193
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/delete#responses-delete-response_id"
|
|
194
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
195
|
+
<span class="property-type">string</span>
|
|
196
|
+
</dt>
|
|
197
|
+
<dd>The ID of the response to delete.</dd>
|
|
198
|
+
</dl>
|
|
199
|
+
|
|
200
|
+
<h4 style="font-weight: bolder;"> ⋙ List Input Items</h4>
|
|
201
|
+
<p>Returns a list of input items for a given response.</p>
|
|
202
|
+
<dl class="message-properties">
|
|
203
|
+
<h4>msg.payload Properties</h4>
|
|
204
|
+
|
|
205
|
+
<dt>
|
|
206
|
+
response_id
|
|
207
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/input-items#responses-input-items-response_id"
|
|
208
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
209
|
+
<span class="property-type">string</span>
|
|
210
|
+
</dt>
|
|
211
|
+
<dd>The ID of the response to retrieve input items for.</dd>
|
|
212
|
+
|
|
213
|
+
<dt class="optional">
|
|
214
|
+
after
|
|
215
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/input-items#responses-input-items-after"
|
|
216
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
217
|
+
<span class="property-type">string</span>
|
|
218
|
+
</dt>
|
|
219
|
+
<dd>An item ID to list items after, used in pagination.</dd>
|
|
220
|
+
|
|
221
|
+
<dt class="optional">
|
|
222
|
+
before
|
|
223
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/input-items#responses-input-items-before"
|
|
224
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
225
|
+
<span class="property-type">string</span>
|
|
226
|
+
</dt>
|
|
227
|
+
<dd>An item ID to list items before, used in pagination.</dd>
|
|
228
|
+
|
|
229
|
+
<dt class="optional">
|
|
230
|
+
limit
|
|
231
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/input-items#responses-input-items-limit"
|
|
232
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
233
|
+
<span class="property-type">integer</span>
|
|
234
|
+
</dt>
|
|
235
|
+
<dd>A limit on the number of objects to be returned.</dd>
|
|
236
|
+
|
|
237
|
+
<dt class="optional">
|
|
238
|
+
order
|
|
239
|
+
<a href="https://platform.openai.com/docs/api-reference/responses/input-items#responses-input-items-order"
|
|
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>The order to return the input items in. Default is <code>asc</code>.</dd>
|
|
244
|
+
|
|
245
|
+
</dl>
|
|
246
|
+
|
|
247
|
+
</details>
|
|
248
|
+
</section>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
|
|
3
|
+
async function createModelResponse(parameters) {
|
|
4
|
+
const { _node, ...params } = parameters;
|
|
5
|
+
const openai = new OpenAI(this.clientParams);
|
|
6
|
+
const response = await openai.responses.create(parameters.payload);
|
|
7
|
+
|
|
8
|
+
if (params.payload.stream) {
|
|
9
|
+
_node.status({
|
|
10
|
+
fill: "green",
|
|
11
|
+
shape: "dot",
|
|
12
|
+
text: "OpenaiApi.status.streaming",
|
|
13
|
+
});
|
|
14
|
+
for await (const chunk of response) {
|
|
15
|
+
if (typeof chunk === "object") {
|
|
16
|
+
const newMsg = { ...parameters.msg, payload: chunk };
|
|
17
|
+
_node.send(newMsg);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
_node.status({});
|
|
21
|
+
} else {
|
|
22
|
+
return response;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function getModelResponse(parameters) {
|
|
27
|
+
const openai = new OpenAI(this.clientParams);
|
|
28
|
+
const { response_id, ...params } = parameters.payload;
|
|
29
|
+
const response = await openai.responses.retrieve(response_id, params);
|
|
30
|
+
|
|
31
|
+
return response;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function deleteModelResponse(parameters) {
|
|
35
|
+
const openai = new OpenAI(this.clientParams);
|
|
36
|
+
const { response_id, ...params } = parameters.payload;
|
|
37
|
+
const response = await openai.responses.del(response_id, params);
|
|
38
|
+
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function listInputItems(parameters) {
|
|
43
|
+
const openai = new OpenAI(this.clientParams);
|
|
44
|
+
const { response_id, ...params } = parameters.payload;
|
|
45
|
+
const list = await openai.responses.inputItems.list(response_id, params);
|
|
46
|
+
|
|
47
|
+
return [...list.data];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = {
|
|
51
|
+
createModelResponse,
|
|
52
|
+
getModelResponse,
|
|
53
|
+
deleteModelResponse,
|
|
54
|
+
listInputItems,
|
|
55
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="🗨️ Responses">
|
|
2
|
+
<option
|
|
3
|
+
value="createModelResponse"
|
|
4
|
+
data-i18n="OpenaiApi.parameters.createModelResponse"
|
|
5
|
+
></option>
|
|
6
|
+
|
|
7
|
+
<option
|
|
8
|
+
value="getModelResponse"
|
|
9
|
+
data-i18n="OpenaiApi.parameters.getModelResponse"
|
|
10
|
+
></option>
|
|
11
|
+
|
|
12
|
+
<option
|
|
13
|
+
value="deleteModelResponse"
|
|
14
|
+
data-i18n="OpenaiApi.parameters.deleteModelResponse"
|
|
15
|
+
></option>
|
|
16
|
+
|
|
17
|
+
<option
|
|
18
|
+
value="listInputItems"
|
|
19
|
+
data-i18n="OpenaiApi.parameters.listInputItems"
|
|
20
|
+
></option>
|
|
21
|
+
|
|
22
|
+
</optgroup>
|