@inductiv/node-red-openai-api 1.103.0 → 6.22.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 +165 -95
- package/examples/responses/mcp.json +1 -1
- package/lib.js +7035 -13298
- package/locales/en-US/node.json +49 -1
- package/node.html +1526 -981
- package/node.js +194 -54
- package/package.json +8 -7
- package/src/assistants/help.html +1 -77
- package/src/audio/help.html +1 -37
- package/src/batch/help.html +3 -17
- package/src/chat/help.html +11 -89
- package/src/container-files/help.html +1 -27
- package/src/containers/help.html +8 -18
- package/src/conversations/help.html +135 -0
- package/src/conversations/methods.js +73 -0
- package/src/conversations/template.html +10 -0
- package/src/embeddings/help.html +1 -11
- package/src/evals/help.html +249 -0
- package/src/evals/methods.js +114 -0
- package/src/evals/template.html +14 -0
- package/src/files/help.html +4 -17
- package/src/fine-tuning/help.html +1 -35
- package/src/images/help.html +1 -45
- package/src/lib.js +53 -1
- package/src/messages/help.html +19 -39
- package/src/messages/methods.js +13 -0
- package/src/messages/template.html +7 -18
- package/src/models/help.html +1 -5
- package/src/moderations/help.html +1 -5
- package/src/node.html +126 -37
- package/src/realtime/help.html +129 -0
- package/src/realtime/methods.js +45 -0
- package/src/realtime/template.html +7 -0
- package/src/responses/help.html +203 -61
- package/src/responses/methods.js +49 -16
- package/src/responses/template.html +16 -1
- package/src/runs/help.html +1 -123
- package/src/skills/help.html +183 -0
- package/src/skills/methods.js +99 -0
- package/src/skills/template.html +13 -0
- package/src/threads/help.html +1 -15
- package/src/uploads/help.html +1 -21
- package/src/vector-store-file-batches/help.html +1 -27
- package/src/vector-store-file-batches/methods.js +5 -5
- package/src/vector-store-files/help.html +1 -25
- package/src/vector-store-files/methods.js +4 -7
- package/src/vector-stores/help.html +2 -31
- package/src/vector-stores/methods.js +5 -11
- package/src/vector-stores/template.html +7 -22
- package/src/videos/help.html +113 -0
- package/src/videos/methods.js +50 -0
- package/src/videos/template.html +8 -0
- package/src/webhooks/help.html +61 -0
- package/src/webhooks/methods.js +40 -0
- package/src/webhooks/template.html +4 -0
- package/test/openai-methods-mapping.test.js +1220 -0
- package/test/openai-node-auth-routing.test.js +203 -0
- package/test/service-host-editor-template.test.js +53 -0
- package/test/service-host-node.test.js +182 -0
- package/test/services.test.js +147 -0
- package/test/utils.test.js +75 -0
package/src/responses/help.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<section>
|
|
2
2
|
<details>
|
|
3
3
|
<summary style="font-weight: bold;">🗨️ Responses</summary>
|
|
4
|
-
<a href="https://
|
|
4
|
+
<a href="https://developers.openai.com/api/reference/typescript/resources/responses/" target="_blank">Official Documentation
|
|
5
5
|
<i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
6
6
|
<h4 style="font-weight: bolder;"> ⋙ Create Model Response</h4>
|
|
7
7
|
<p>Creates a model response.</p>
|
|
@@ -10,129 +10,145 @@
|
|
|
10
10
|
|
|
11
11
|
<dt>
|
|
12
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
13
|
<span class="property-type">string | array</span>
|
|
16
14
|
</dt>
|
|
17
15
|
<dd>Text, image, or file inputs to the model, used to generate a response.</dd>
|
|
18
16
|
|
|
19
17
|
<dt>
|
|
20
18
|
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
19
|
<span class="property-type">string</span>
|
|
24
20
|
</dt>
|
|
25
21
|
<dd>Model ID used to generate the response.</dd>
|
|
26
22
|
|
|
23
|
+
<dt class="optional">
|
|
24
|
+
background
|
|
25
|
+
<span class="property-type">boolean</span>
|
|
26
|
+
</dt>
|
|
27
|
+
<dd>Whether to run the model response in the background.</dd>
|
|
28
|
+
|
|
29
|
+
<dt class="optional">
|
|
30
|
+
context_management
|
|
31
|
+
<span class="property-type">array</span>
|
|
32
|
+
</dt>
|
|
33
|
+
<dd>Context management settings, including compaction behavior.</dd>
|
|
34
|
+
|
|
35
|
+
<dt class="optional">
|
|
36
|
+
conversation
|
|
37
|
+
<span class="property-type">string | object</span>
|
|
38
|
+
</dt>
|
|
39
|
+
<dd>Conversation context to prepend for this response.</dd>
|
|
40
|
+
|
|
27
41
|
<dt class="optional">
|
|
28
42
|
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
43
|
<span class="property-type">array</span>
|
|
32
44
|
</dt>
|
|
33
45
|
<dd>Specify additional output data to include in the model response.</dd>
|
|
34
46
|
|
|
35
47
|
<dt class="optional">
|
|
36
48
|
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
49
|
<span class="property-type">string</span>
|
|
40
50
|
</dt>
|
|
41
51
|
<dd>Inserts a system (or developer) message as the first item in the model's context.</dd>
|
|
42
52
|
|
|
43
53
|
<dt class="optional">
|
|
44
54
|
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
55
|
<span class="property-type">integer</span>
|
|
48
56
|
</dt>
|
|
49
57
|
<dd>An upper bound for the number of tokens that can be generated for a response.</dd>
|
|
50
58
|
|
|
51
59
|
<dt class="optional">
|
|
52
60
|
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
61
|
<span class="property-type">object</span>
|
|
56
62
|
</dt>
|
|
57
63
|
<dd>Set of 16 key-value pairs that can be attached to an object.</dd>
|
|
58
64
|
|
|
59
65
|
<dt class="optional">
|
|
60
66
|
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
67
|
<span class="property-type">boolean</span>
|
|
64
68
|
</dt>
|
|
65
69
|
<dd>Whether to allow the model to run tool calls in parallel.</dd>
|
|
66
70
|
|
|
67
71
|
<dt class="optional">
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
71
|
-
<span class="property-type">boolean</span>
|
|
72
|
+
previous_response_id
|
|
73
|
+
<span class="property-type">string</span>
|
|
72
74
|
</dt>
|
|
73
|
-
<dd>
|
|
75
|
+
<dd>The unique ID of the previous response to the model.</dd>
|
|
74
76
|
|
|
75
77
|
<dt class="optional">
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
78
|
+
prompt
|
|
79
|
+
<span class="property-type">object</span>
|
|
80
|
+
</dt>
|
|
81
|
+
<dd>Reference to a reusable prompt template and variables.</dd>
|
|
82
|
+
|
|
83
|
+
<dt class="optional">
|
|
84
|
+
prompt_cache_key
|
|
79
85
|
<span class="property-type">string</span>
|
|
80
86
|
</dt>
|
|
81
|
-
<dd>
|
|
87
|
+
<dd>Stable key used to improve prompt cache hit rates.</dd>
|
|
88
|
+
|
|
89
|
+
<dt class="optional">
|
|
90
|
+
prompt_cache_retention
|
|
91
|
+
<span class="property-type">string</span>
|
|
92
|
+
</dt>
|
|
93
|
+
<dd>Prompt cache retention policy, such as <code>in-memory</code> or <code>24h</code>.</dd>
|
|
82
94
|
|
|
83
95
|
<dt class="optional">
|
|
84
96
|
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
97
|
<span class="property-type">object</span>
|
|
88
98
|
</dt>
|
|
89
99
|
<dd>o-series models only. See official docs for option properties.</dd>
|
|
90
100
|
|
|
101
|
+
<dt class="optional">
|
|
102
|
+
safety_identifier
|
|
103
|
+
<span class="property-type">string</span>
|
|
104
|
+
</dt>
|
|
105
|
+
<dd>Stable end-user identifier used for abuse detection and safety controls.</dd>
|
|
106
|
+
|
|
107
|
+
<dt class="optional">
|
|
108
|
+
service_tier
|
|
109
|
+
<span class="property-type">string</span>
|
|
110
|
+
</dt>
|
|
111
|
+
<dd>Service tier selection, for example <code>default</code>, <code>flex</code>, or <code>priority</code>.</dd>
|
|
112
|
+
|
|
91
113
|
<dt class="optional">
|
|
92
114
|
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
115
|
<span class="property-type">boolean</span>
|
|
96
116
|
</dt>
|
|
97
117
|
<dd>Whether to store the generated model response for later retrieval via API.</dd>
|
|
98
118
|
|
|
99
119
|
<dt class="optional">
|
|
100
120
|
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
121
|
<span class="property-type">boolean</span>
|
|
104
122
|
</dt>
|
|
105
123
|
<dd>If set to true, the model response data will be streamed to the client as it is generated using
|
|
106
124
|
server-sent events.</dd>
|
|
107
125
|
|
|
126
|
+
<dt class="optional">
|
|
127
|
+
stream_options
|
|
128
|
+
<span class="property-type">object</span>
|
|
129
|
+
</dt>
|
|
130
|
+
<dd>Streaming options such as obfuscation behavior for event payloads.</dd>
|
|
131
|
+
|
|
108
132
|
<dt class="optional">
|
|
109
133
|
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
134
|
<span class="property-type">number</span>
|
|
113
135
|
</dt>
|
|
114
136
|
<dd>What sampling temperature to use, between 0 and 2.</dd>
|
|
115
137
|
|
|
116
138
|
<dt class="optional">
|
|
117
139
|
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
140
|
<span class="property-type">object</span>
|
|
121
141
|
</dt>
|
|
122
142
|
<dd>Configuration options for a text response from the model.</dd>
|
|
123
143
|
|
|
124
144
|
<dt class="optional">
|
|
125
145
|
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
146
|
<span class="property-type">string or object</span>
|
|
129
147
|
</dt>
|
|
130
148
|
<dd>How the model should select which tool (or tools) to use when generating a response.</dd>
|
|
131
149
|
|
|
132
150
|
<dt class="optional">
|
|
133
151
|
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
152
|
<span class="property-type">array</span>
|
|
137
153
|
</dt>
|
|
138
154
|
<dd>
|
|
@@ -145,27 +161,21 @@
|
|
|
145
161
|
|
|
146
162
|
<dt class="optional">
|
|
147
163
|
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
164
|
<span class="property-type">number</span>
|
|
151
165
|
</dt>
|
|
152
166
|
<dd>An alternative to sampling with temperature, called nucleus sampling.</dd>
|
|
153
167
|
|
|
154
168
|
<dt class="optional">
|
|
155
169
|
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
170
|
<span class="property-type">string</span>
|
|
159
171
|
</dt>
|
|
160
172
|
<dd>The truncation strategy to use for the model response.</dd>
|
|
161
173
|
|
|
162
174
|
<dt class="optional">
|
|
163
175
|
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
176
|
<span class="property-type">string</span>
|
|
167
177
|
</dt>
|
|
168
|
-
<dd>
|
|
178
|
+
<dd>Deprecated. Prefer <code>safety_identifier</code> and <code>prompt_cache_key</code>.</dd>
|
|
169
179
|
|
|
170
180
|
</dl>
|
|
171
181
|
|
|
@@ -176,11 +186,33 @@
|
|
|
176
186
|
|
|
177
187
|
<dt>
|
|
178
188
|
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
189
|
<span class="property-type">string</span>
|
|
182
190
|
</dt>
|
|
183
191
|
<dd>The ID of the response to retrieve.</dd>
|
|
192
|
+
|
|
193
|
+
<dt class="optional">
|
|
194
|
+
include
|
|
195
|
+
<span class="property-type">array</span>
|
|
196
|
+
</dt>
|
|
197
|
+
<dd>Additional output fields to include in the response.</dd>
|
|
198
|
+
|
|
199
|
+
<dt class="optional">
|
|
200
|
+
include_obfuscation
|
|
201
|
+
<span class="property-type">boolean</span>
|
|
202
|
+
</dt>
|
|
203
|
+
<dd>Enable obfuscation payloads in streaming events.</dd>
|
|
204
|
+
|
|
205
|
+
<dt class="optional">
|
|
206
|
+
starting_after
|
|
207
|
+
<span class="property-type">integer</span>
|
|
208
|
+
</dt>
|
|
209
|
+
<dd>Event sequence number after which to begin a streamed retrieval.</dd>
|
|
210
|
+
|
|
211
|
+
<dt class="optional">
|
|
212
|
+
stream
|
|
213
|
+
<span class="property-type">boolean</span>
|
|
214
|
+
</dt>
|
|
215
|
+
<dd>When true, retrieve the response as a stream of events.</dd>
|
|
184
216
|
</dl>
|
|
185
217
|
|
|
186
218
|
<h4 style="font-weight: bolder;"> ⋙ Delete Model Response</h4>
|
|
@@ -190,13 +222,53 @@
|
|
|
190
222
|
|
|
191
223
|
<dt>
|
|
192
224
|
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
225
|
<span class="property-type">string</span>
|
|
196
226
|
</dt>
|
|
197
227
|
<dd>The ID of the response to delete.</dd>
|
|
198
228
|
</dl>
|
|
199
229
|
|
|
230
|
+
<h4 style="font-weight: bolder;"> ⋙ Cancel Model Response</h4>
|
|
231
|
+
<p>Cancels an in-progress model response.</p>
|
|
232
|
+
<dl class="message-properties">
|
|
233
|
+
<h4>msg.payload Properties</h4>
|
|
234
|
+
|
|
235
|
+
<dt>
|
|
236
|
+
response_id
|
|
237
|
+
<span class="property-type">string</span>
|
|
238
|
+
</dt>
|
|
239
|
+
<dd>The ID of the response to cancel.</dd>
|
|
240
|
+
</dl>
|
|
241
|
+
|
|
242
|
+
<h4 style="font-weight: bolder;"> ⋙ Compact Model Response</h4>
|
|
243
|
+
<p>Compacts prior conversation content to reduce context size while preserving continuity.</p>
|
|
244
|
+
<dl class="message-properties">
|
|
245
|
+
<h4>msg.payload Properties</h4>
|
|
246
|
+
|
|
247
|
+
<dt>
|
|
248
|
+
model
|
|
249
|
+
<span class="property-type">string</span>
|
|
250
|
+
</dt>
|
|
251
|
+
<dd>Model ID used for compaction.</dd>
|
|
252
|
+
|
|
253
|
+
<dt class="optional">
|
|
254
|
+
input
|
|
255
|
+
<span class="property-type">string | array</span>
|
|
256
|
+
</dt>
|
|
257
|
+
<dd>Optional input items used for compaction.</dd>
|
|
258
|
+
|
|
259
|
+
<dt class="optional">
|
|
260
|
+
instructions
|
|
261
|
+
<span class="property-type">string</span>
|
|
262
|
+
</dt>
|
|
263
|
+
<dd>Optional system or developer instructions for compaction.</dd>
|
|
264
|
+
|
|
265
|
+
<dt class="optional">
|
|
266
|
+
previous_response_id
|
|
267
|
+
<span class="property-type">string</span>
|
|
268
|
+
</dt>
|
|
269
|
+
<dd>Optional previous response id to continue compaction context.</dd>
|
|
270
|
+
</dl>
|
|
271
|
+
|
|
200
272
|
<h4 style="font-weight: bolder;"> ⋙ List Input Items</h4>
|
|
201
273
|
<p>Returns a list of input items for a given response.</p>
|
|
202
274
|
<dl class="message-properties">
|
|
@@ -204,45 +276,115 @@
|
|
|
204
276
|
|
|
205
277
|
<dt>
|
|
206
278
|
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
279
|
<span class="property-type">string</span>
|
|
210
280
|
</dt>
|
|
211
281
|
<dd>The ID of the response to retrieve input items for.</dd>
|
|
212
282
|
|
|
213
283
|
<dt class="optional">
|
|
214
284
|
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
285
|
<span class="property-type">string</span>
|
|
218
286
|
</dt>
|
|
219
287
|
<dd>An item ID to list items after, used in pagination.</dd>
|
|
220
288
|
|
|
221
289
|
<dt class="optional">
|
|
222
290
|
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
291
|
<span class="property-type">string</span>
|
|
226
292
|
</dt>
|
|
227
293
|
<dd>An item ID to list items before, used in pagination.</dd>
|
|
228
294
|
|
|
229
295
|
<dt class="optional">
|
|
230
296
|
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
297
|
<span class="property-type">integer</span>
|
|
234
298
|
</dt>
|
|
235
299
|
<dd>A limit on the number of objects to be returned.</dd>
|
|
236
300
|
|
|
237
301
|
<dt class="optional">
|
|
238
302
|
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
303
|
<span class="property-type">string</span>
|
|
242
304
|
</dt>
|
|
243
|
-
<dd>The order to return the input items in. Default is <code>
|
|
305
|
+
<dd>The order to return the input items in. Default is <code>desc</code>.</dd>
|
|
306
|
+
|
|
307
|
+
<dt class="optional">
|
|
308
|
+
include
|
|
309
|
+
<span class="property-type">array</span>
|
|
310
|
+
</dt>
|
|
311
|
+
<dd>Additional fields to include on the returned input items.</dd>
|
|
312
|
+
|
|
313
|
+
</dl>
|
|
314
|
+
|
|
315
|
+
<h4 style="font-weight: bolder;"> ⋙ Count Input Tokens</h4>
|
|
316
|
+
<p>Counts input tokens before creating a model response.</p>
|
|
317
|
+
<dl class="message-properties">
|
|
318
|
+
<h4>msg.payload Properties</h4>
|
|
319
|
+
|
|
320
|
+
<dt class="optional">
|
|
321
|
+
model
|
|
322
|
+
<span class="property-type">string</span>
|
|
323
|
+
</dt>
|
|
324
|
+
<dd>Model ID to use for token counting.</dd>
|
|
325
|
+
|
|
326
|
+
<dt class="optional">
|
|
327
|
+
input
|
|
328
|
+
<span class="property-type">string | array</span>
|
|
329
|
+
</dt>
|
|
330
|
+
<dd>Input items to count.</dd>
|
|
331
|
+
|
|
332
|
+
<dt class="optional">
|
|
333
|
+
conversation
|
|
334
|
+
<span class="property-type">string | object</span>
|
|
335
|
+
</dt>
|
|
336
|
+
<dd>Conversation context to include in counting.</dd>
|
|
337
|
+
|
|
338
|
+
<dt class="optional">
|
|
339
|
+
instructions
|
|
340
|
+
<span class="property-type">string</span>
|
|
341
|
+
</dt>
|
|
342
|
+
<dd>System or developer instructions to include in counting.</dd>
|
|
343
|
+
|
|
344
|
+
<dt class="optional">
|
|
345
|
+
previous_response_id
|
|
346
|
+
<span class="property-type">string</span>
|
|
347
|
+
</dt>
|
|
348
|
+
<dd>Previous response ID used to continue conversation context.</dd>
|
|
349
|
+
|
|
350
|
+
<dt class="optional">
|
|
351
|
+
parallel_tool_calls
|
|
352
|
+
<span class="property-type">boolean</span>
|
|
353
|
+
</dt>
|
|
354
|
+
<dd>Whether tool calls may run in parallel for the modeled request.</dd>
|
|
355
|
+
|
|
356
|
+
<dt class="optional">
|
|
357
|
+
reasoning
|
|
358
|
+
<span class="property-type">object</span>
|
|
359
|
+
</dt>
|
|
360
|
+
<dd>Reasoning model configuration used for token accounting.</dd>
|
|
361
|
+
|
|
362
|
+
<dt class="optional">
|
|
363
|
+
text
|
|
364
|
+
<span class="property-type">object</span>
|
|
365
|
+
</dt>
|
|
366
|
+
<dd>Text output configuration used when estimating token usage.</dd>
|
|
367
|
+
|
|
368
|
+
<dt class="optional">
|
|
369
|
+
tool_choice
|
|
370
|
+
<span class="property-type">string | object</span>
|
|
371
|
+
</dt>
|
|
372
|
+
<dd>Tool selection mode used for token counting.</dd>
|
|
373
|
+
|
|
374
|
+
<dt class="optional">
|
|
375
|
+
tools
|
|
376
|
+
<span class="property-type">array</span>
|
|
377
|
+
</dt>
|
|
378
|
+
<dd>Tool definitions used for token counting.</dd>
|
|
379
|
+
|
|
380
|
+
<dt class="optional">
|
|
381
|
+
truncation
|
|
382
|
+
<span class="property-type">string</span>
|
|
383
|
+
</dt>
|
|
384
|
+
<dd>Truncation strategy for token counting context.
|
|
385
|
+
</dd>
|
|
244
386
|
|
|
245
387
|
</dl>
|
|
246
388
|
|
|
247
389
|
</details>
|
|
248
|
-
</section>
|
|
390
|
+
</section>
|
package/src/responses/methods.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
const OpenAI = require("openai").OpenAI;
|
|
2
2
|
|
|
3
|
+
async function streamResponse(parameters, response) {
|
|
4
|
+
const { _node, msg } = parameters;
|
|
5
|
+
_node.status({
|
|
6
|
+
fill: "green",
|
|
7
|
+
shape: "dot",
|
|
8
|
+
text: "OpenaiApi.status.streaming",
|
|
9
|
+
});
|
|
10
|
+
for await (const chunk of response) {
|
|
11
|
+
if (typeof chunk === "object") {
|
|
12
|
+
const newMsg = { ...msg, payload: chunk };
|
|
13
|
+
_node.send(newMsg);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
_node.status({});
|
|
17
|
+
}
|
|
18
|
+
|
|
3
19
|
async function createModelResponse(parameters) {
|
|
4
|
-
const { _node, ...params } = parameters;
|
|
5
20
|
const openai = new OpenAI(this.clientParams);
|
|
6
21
|
const response = await openai.responses.create(parameters.payload);
|
|
7
22
|
|
|
8
|
-
if (
|
|
9
|
-
|
|
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({});
|
|
23
|
+
if (parameters.payload.stream) {
|
|
24
|
+
await streamResponse(parameters, response);
|
|
21
25
|
} else {
|
|
22
26
|
return response;
|
|
23
27
|
}
|
|
@@ -28,13 +32,32 @@ async function getModelResponse(parameters) {
|
|
|
28
32
|
const { response_id, ...params } = parameters.payload;
|
|
29
33
|
const response = await openai.responses.retrieve(response_id, params);
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
if (params.stream) {
|
|
36
|
+
await streamResponse(parameters, response);
|
|
37
|
+
} else {
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
async function deleteModelResponse(parameters) {
|
|
35
43
|
const openai = new OpenAI(this.clientParams);
|
|
36
44
|
const { response_id, ...params } = parameters.payload;
|
|
37
|
-
const response = await openai.responses.
|
|
45
|
+
const response = await openai.responses.delete(response_id, params);
|
|
46
|
+
|
|
47
|
+
return response;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function cancelModelResponse(parameters) {
|
|
51
|
+
const openai = new OpenAI(this.clientParams);
|
|
52
|
+
const { response_id, ...params } = parameters.payload;
|
|
53
|
+
const response = await openai.responses.cancel(response_id, params);
|
|
54
|
+
|
|
55
|
+
return response;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function compactModelResponse(parameters) {
|
|
59
|
+
const openai = new OpenAI(this.clientParams);
|
|
60
|
+
const response = await openai.responses.compact(parameters.payload);
|
|
38
61
|
|
|
39
62
|
return response;
|
|
40
63
|
}
|
|
@@ -47,9 +70,19 @@ async function listInputItems(parameters) {
|
|
|
47
70
|
return [...list.data];
|
|
48
71
|
}
|
|
49
72
|
|
|
73
|
+
async function countInputTokens(parameters) {
|
|
74
|
+
const openai = new OpenAI(this.clientParams);
|
|
75
|
+
const response = await openai.responses.inputTokens.count(parameters.payload);
|
|
76
|
+
|
|
77
|
+
return response;
|
|
78
|
+
}
|
|
79
|
+
|
|
50
80
|
module.exports = {
|
|
51
81
|
createModelResponse,
|
|
52
82
|
getModelResponse,
|
|
53
83
|
deleteModelResponse,
|
|
84
|
+
cancelModelResponse,
|
|
85
|
+
compactModelResponse,
|
|
54
86
|
listInputItems,
|
|
87
|
+
countInputTokens,
|
|
55
88
|
};
|
|
@@ -14,9 +14,24 @@
|
|
|
14
14
|
data-i18n="OpenaiApi.parameters.deleteModelResponse"
|
|
15
15
|
></option>
|
|
16
16
|
|
|
17
|
+
<option
|
|
18
|
+
value="cancelModelResponse"
|
|
19
|
+
data-i18n="OpenaiApi.parameters.cancelModelResponse"
|
|
20
|
+
></option>
|
|
21
|
+
|
|
22
|
+
<option
|
|
23
|
+
value="compactModelResponse"
|
|
24
|
+
data-i18n="OpenaiApi.parameters.compactModelResponse"
|
|
25
|
+
></option>
|
|
26
|
+
|
|
17
27
|
<option
|
|
18
28
|
value="listInputItems"
|
|
19
29
|
data-i18n="OpenaiApi.parameters.listInputItems"
|
|
20
30
|
></option>
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
<option
|
|
33
|
+
value="countInputTokens"
|
|
34
|
+
data-i18n="OpenaiApi.parameters.countInputTokens"
|
|
35
|
+
></option>
|
|
36
|
+
|
|
37
|
+
</optgroup>
|