@inductiv/node-red-openai-api 1.89.0 → 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 +16 -15
- 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 -3858
- 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,187 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🔧 Fine-tuning</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning" 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 Fine-tuning Job</h4>
|
|
7
|
+
<p>
|
|
8
|
+
Creates a job that fine-tunes a specified model from a given dataset.
|
|
9
|
+
Response includes details of the enqueued job including job status and the
|
|
10
|
+
name of the fine-tuned models once complete.
|
|
11
|
+
</p>
|
|
12
|
+
<dl class="message-properties">
|
|
13
|
+
<h4>msg.payload Properties</h4>
|
|
14
|
+
|
|
15
|
+
<dt>
|
|
16
|
+
model
|
|
17
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-model"
|
|
18
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
19
|
+
<span class="property-type">string</span>
|
|
20
|
+
</dt>
|
|
21
|
+
<dd>The name of the model to fine-tune.</dd>
|
|
22
|
+
<dt>
|
|
23
|
+
training_file
|
|
24
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-training_file"
|
|
25
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
26
|
+
<span class="property-type">string</span>
|
|
27
|
+
</dt>
|
|
28
|
+
<dd>The ID of an uploaded file that contains training data.</dd>
|
|
29
|
+
|
|
30
|
+
<dt class="optional">
|
|
31
|
+
suffix
|
|
32
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-suffix"
|
|
33
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
34
|
+
<span class="property-type">string</span>
|
|
35
|
+
</dt>
|
|
36
|
+
<dd>
|
|
37
|
+
A string of up to 18 characters that will be added to your fine-tuned
|
|
38
|
+
model name.
|
|
39
|
+
</dd>
|
|
40
|
+
|
|
41
|
+
<dt class="optional">
|
|
42
|
+
validation_file
|
|
43
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-validation_file"
|
|
44
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
45
|
+
<span class="property-type">string</span>
|
|
46
|
+
</dt>
|
|
47
|
+
<dd>The ID of an uploaded file that contains validation data.</dd>
|
|
48
|
+
|
|
49
|
+
<dt class="optional">
|
|
50
|
+
integrations
|
|
51
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-integrations"
|
|
52
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
53
|
+
<span class="property-type">array</span>
|
|
54
|
+
</dt>
|
|
55
|
+
<dd>A list of integrations to enable for your fine-tuning job.</dd>
|
|
56
|
+
|
|
57
|
+
<dt class="optional">
|
|
58
|
+
seed
|
|
59
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-seed"
|
|
60
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
61
|
+
<span class="property-type">array</span>
|
|
62
|
+
</dt>
|
|
63
|
+
<dd>The seed controls the reproducibility of the job.</dd>
|
|
64
|
+
|
|
65
|
+
<dt class="optional">
|
|
66
|
+
method
|
|
67
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/create#fine-tuning-create-method"
|
|
68
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
69
|
+
<span class="property-type">object</span>
|
|
70
|
+
</dt>
|
|
71
|
+
<dd>The method used for fine-tuning.</dd>
|
|
72
|
+
|
|
73
|
+
</dl>
|
|
74
|
+
|
|
75
|
+
<h4 style="font-weight: bolder;"> ⋙ List Fine-tuning Jobs</h4>
|
|
76
|
+
<p>List your organization's fine-tuning jobs</p>
|
|
77
|
+
<dl class="message-properties">
|
|
78
|
+
<h4>msg.payload Properties</h4>
|
|
79
|
+
|
|
80
|
+
<dt class="optional">
|
|
81
|
+
after
|
|
82
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list#fine-tuning-list-after"
|
|
83
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
84
|
+
<span class="property-type">string</span>
|
|
85
|
+
</dt>
|
|
86
|
+
<dd>Identifier for the last job from the previous pagination request.</dd>
|
|
87
|
+
<dt class="optional">
|
|
88
|
+
limit
|
|
89
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list#fine-tuning-list-limit"
|
|
90
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
91
|
+
<span class="property-type">integer</span>
|
|
92
|
+
</dt>
|
|
93
|
+
<dd>Number of fine-tuning jobs to retrieve.</dd>
|
|
94
|
+
</dl>
|
|
95
|
+
|
|
96
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve Fine-tuning Job</h4>
|
|
97
|
+
<p>Get info about a fine-tuning job.</p>
|
|
98
|
+
<dl class="message-properties">
|
|
99
|
+
<h4>msg.payload Properties</h4>
|
|
100
|
+
|
|
101
|
+
<dt>
|
|
102
|
+
fine_tuning_job_id
|
|
103
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/retrieve#fine-tuning-retrieve-fine_tuning_job_id"
|
|
104
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
105
|
+
<span class="property-type">string</span>
|
|
106
|
+
</dt>
|
|
107
|
+
<dd>The ID of the fine-tuning job.</dd>
|
|
108
|
+
</dl>
|
|
109
|
+
|
|
110
|
+
<h4 style="font-weight: bolder;"> ⋙ List Fine-tuning Events</h4>
|
|
111
|
+
<p>Get status updates for a fine-tuning job.</p>
|
|
112
|
+
<dl class="message-properties">
|
|
113
|
+
<h4>msg.payload Properties</h4>
|
|
114
|
+
|
|
115
|
+
<dt>
|
|
116
|
+
fine_tuning_job_id
|
|
117
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-events#fine-tuning-list-events-fine_tuning_job_id"
|
|
118
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
119
|
+
<span class="property-type">string</span>
|
|
120
|
+
</dt>
|
|
121
|
+
<dd>The ID of the fine-tuning job to get events for.</dd>
|
|
122
|
+
<dt class="optional">
|
|
123
|
+
after
|
|
124
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-events#fine-tuning-list-events-after"
|
|
125
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
126
|
+
<span class="property-type">string</span>
|
|
127
|
+
</dt>
|
|
128
|
+
<dd>
|
|
129
|
+
Identifier for the last event from the previous pagination request.
|
|
130
|
+
</dd>
|
|
131
|
+
<dt class="optional">
|
|
132
|
+
limit
|
|
133
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-events#fine-tuning-list-events-limit"
|
|
134
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
135
|
+
<span class="property-type">integer</span>
|
|
136
|
+
</dt>
|
|
137
|
+
<dd>Number of events to retrieve.</dd>
|
|
138
|
+
</dl>
|
|
139
|
+
|
|
140
|
+
<!-- >>> Begin List Fine-tuning Checkpoints -->
|
|
141
|
+
<h4 style="font-weight: bolder;"> ⋙ List Fine-tuning Checkpoints</h4>
|
|
142
|
+
<p>List checkpoints for a fine-tuning job.</p>
|
|
143
|
+
<dl class="message-properties">
|
|
144
|
+
<h4>msg.payload Properties</h4>
|
|
145
|
+
|
|
146
|
+
<dt>
|
|
147
|
+
fine_tuning_job_id
|
|
148
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints#fine-tuning-list-checkpoints-fine_tuning_job_id"
|
|
149
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
150
|
+
<span class="property-type">string</span>
|
|
151
|
+
</dt>
|
|
152
|
+
<dd>The ID of the fine-tuning job to get checkpoints for.</dd>
|
|
153
|
+
<dt class="optional">
|
|
154
|
+
after
|
|
155
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints#fine-tuning-list-checkpoints-after"
|
|
156
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
157
|
+
<span class="property-type">string</span>
|
|
158
|
+
</dt>
|
|
159
|
+
<dd>
|
|
160
|
+
Identifier for the last checkpoint ID from the previous pagination request.
|
|
161
|
+
</dd>
|
|
162
|
+
<dt class="optional">
|
|
163
|
+
limit
|
|
164
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/list-checkpoints#fine-tuning-list-checkpoints-limit"
|
|
165
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
166
|
+
<span class="property-type">integer</span>
|
|
167
|
+
</dt>
|
|
168
|
+
<dd>Number of events to retrieve.</dd>
|
|
169
|
+
</dl>
|
|
170
|
+
<!-- <<< End List Fine-tuning Checkpoints -->
|
|
171
|
+
|
|
172
|
+
<h4 style="font-weight: bolder;"> ⋙ Cancel Fine-tuning Job</h4>
|
|
173
|
+
<p>Immediately cancel a fine-tune job.</p>
|
|
174
|
+
<dl class="message-properties">
|
|
175
|
+
<h4>msg.payload Properties</h4>
|
|
176
|
+
|
|
177
|
+
<dt>
|
|
178
|
+
fine_tuning_job_id
|
|
179
|
+
<a href="https://platform.openai.com/docs/api-reference/fine-tuning/cancel#fine-tuning-cancel-fine_tuning_job_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 fine-tuning job to cancel.</dd>
|
|
184
|
+
</dl>
|
|
185
|
+
|
|
186
|
+
</details>
|
|
187
|
+
</section>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
|
|
3
|
+
async function createFineTuningJob(parameters) {
|
|
4
|
+
const openai = new OpenAI(this.clientParams);
|
|
5
|
+
const response = await openai.fineTuning.jobs.create(parameters.payload);
|
|
6
|
+
|
|
7
|
+
return response;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
async function listPaginatedFineTuningJobs(parameters) {
|
|
11
|
+
const openai = new OpenAI(this.clientParams);
|
|
12
|
+
const list = await openai.fineTuning.jobs.list(parameters.payload);
|
|
13
|
+
|
|
14
|
+
return [...list.data];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function retrieveFineTuningJob(parameters) {
|
|
18
|
+
const openai = new OpenAI(this.clientParams);
|
|
19
|
+
const { fine_tuning_job_id, ...params } = parameters.payload;
|
|
20
|
+
const response = await openai.fineTuning.jobs.retrieve(
|
|
21
|
+
fine_tuning_job_id,
|
|
22
|
+
params
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return response;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function listFineTuningEvents(parameters) {
|
|
29
|
+
const openai = new OpenAI(this.clientParams);
|
|
30
|
+
const { fine_tuning_job_id, ...params } = parameters.payload;
|
|
31
|
+
const list = await openai.fineTuning.jobs.listEvents(
|
|
32
|
+
fine_tuning_job_id,
|
|
33
|
+
params
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return [...list.data];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function listFineTuningCheckpoints(parameters) {
|
|
40
|
+
const openai = new OpenAI(this.clientParams);
|
|
41
|
+
const { fine_tuning_job_id, ...params } = parameters.payload;
|
|
42
|
+
const list = await openai.fineTuning.jobs.checkpoints.list(
|
|
43
|
+
fine_tuning_job_id,
|
|
44
|
+
params
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return [...list.data];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function cancelFineTuningJob(parameters) {
|
|
51
|
+
const openai = new OpenAI(this.clientParams);
|
|
52
|
+
const { fine_tuning_job_id, ...params } = parameters.payload;
|
|
53
|
+
const response = await openai.fineTuning.jobs.cancel(
|
|
54
|
+
fine_tuning_job_id,
|
|
55
|
+
params
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = {
|
|
62
|
+
createFineTuningJob,
|
|
63
|
+
listPaginatedFineTuningJobs,
|
|
64
|
+
retrieveFineTuningJob,
|
|
65
|
+
listFineTuningEvents,
|
|
66
|
+
listFineTuningCheckpoints,
|
|
67
|
+
cancelFineTuningJob,
|
|
68
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="🔧 Fine-tuning">
|
|
2
|
+
<option
|
|
3
|
+
value="createFineTuningJob"
|
|
4
|
+
data-i18n="OpenaiApi.parameters.createFineTuningJob"
|
|
5
|
+
></option>
|
|
6
|
+
<option
|
|
7
|
+
value="listPaginatedFineTuningJobs"
|
|
8
|
+
data-i18n="OpenaiApi.parameters.listPaginatedFineTuningJobs"
|
|
9
|
+
></option>
|
|
10
|
+
<option
|
|
11
|
+
value="retrieveFineTuningJob"
|
|
12
|
+
data-i18n="OpenaiApi.parameters.retrieveFineTuningJob"
|
|
13
|
+
></option>
|
|
14
|
+
<option
|
|
15
|
+
value="listFineTuningEvents"
|
|
16
|
+
data-i18n="OpenaiApi.parameters.listFineTuningEvents"
|
|
17
|
+
></option>
|
|
18
|
+
<option
|
|
19
|
+
value="listFineTuningCheckpoints"
|
|
20
|
+
data-i18n="OpenaiApi.parameters.listFineTuningCheckpoints"
|
|
21
|
+
></option>
|
|
22
|
+
<option
|
|
23
|
+
value="cancelFineTuningJob"
|
|
24
|
+
data-i18n="OpenaiApi.parameters.cancelFineTuningJob"
|
|
25
|
+
></option>
|
|
26
|
+
</optgroup>
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🖼️ Images</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/images" 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 Image</h4>
|
|
7
|
+
<p>Creates an image given a prompt.</p>
|
|
8
|
+
<dl class="message-properties">
|
|
9
|
+
<h4>msg.payload Properties</h4>
|
|
10
|
+
|
|
11
|
+
<dt>
|
|
12
|
+
prompt
|
|
13
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-prompt"
|
|
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>A text description of the desired image(s).</dd>
|
|
18
|
+
<dt class="optional">
|
|
19
|
+
model
|
|
20
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-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>The model to use for image generation.</dd>
|
|
25
|
+
<dt class="optional">
|
|
26
|
+
n
|
|
27
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-n"
|
|
28
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
29
|
+
<span class="property-type">integer</span>
|
|
30
|
+
</dt>
|
|
31
|
+
<dd>The number of images to generate.</dd>
|
|
32
|
+
<dt class="optional">
|
|
33
|
+
quality
|
|
34
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-quality"
|
|
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 quality of the image that will be generated.</dd>
|
|
39
|
+
<dt class="optional">
|
|
40
|
+
response_format
|
|
41
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-response_format"
|
|
42
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
43
|
+
<span class="property-type">string</span>
|
|
44
|
+
</dt>
|
|
45
|
+
<dd>
|
|
46
|
+
The format in which the generated images are returned. Must be one of
|
|
47
|
+
url or b64_json.
|
|
48
|
+
</dd>
|
|
49
|
+
<dt class="optional">
|
|
50
|
+
size
|
|
51
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-size"
|
|
52
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
53
|
+
<span class="property-type">string</span>
|
|
54
|
+
</dt>
|
|
55
|
+
<dd>
|
|
56
|
+
The size of the generated images. Must be one of 256x256, 512x512, or
|
|
57
|
+
1024x1024 for dall-e-2. Must be one of 1024x1024, 1792x1024, or
|
|
58
|
+
1024x1792.
|
|
59
|
+
</dd>
|
|
60
|
+
<dt class="optional">
|
|
61
|
+
style
|
|
62
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-style"
|
|
63
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
64
|
+
<span class="property-type">string</span>
|
|
65
|
+
</dt>
|
|
66
|
+
<dd>
|
|
67
|
+
The style of the generated images. Must be one of vivid or natural.
|
|
68
|
+
</dd>
|
|
69
|
+
<dt class="optional">
|
|
70
|
+
user
|
|
71
|
+
<a href="https://platform.openai.com/docs/api-reference/images/create#images-create-user"
|
|
72
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
73
|
+
<span class="property-type">string</span>
|
|
74
|
+
</dt>
|
|
75
|
+
<dd>
|
|
76
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
77
|
+
monitor and detect abuse.
|
|
78
|
+
</dd>
|
|
79
|
+
</dl>
|
|
80
|
+
|
|
81
|
+
<h4 style="font-weight: bolder;"> ⋙ Create Image Edit</h4>
|
|
82
|
+
<p>
|
|
83
|
+
Creates an edited or extended image given an original image and a prompt.
|
|
84
|
+
</p>
|
|
85
|
+
<dl class="message-properties">
|
|
86
|
+
<h4>msg.payload Properties</h4>
|
|
87
|
+
|
|
88
|
+
<dt>
|
|
89
|
+
image
|
|
90
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-image"
|
|
91
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
92
|
+
<span class="property-type">string</span>
|
|
93
|
+
</dt>
|
|
94
|
+
<dd>The image to edit.</dd>
|
|
95
|
+
<dt>
|
|
96
|
+
prompt
|
|
97
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-prompt"
|
|
98
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
99
|
+
<span class="property-type">string</span>
|
|
100
|
+
</dt>
|
|
101
|
+
<dd>A text description of the desired image(s).</dd>
|
|
102
|
+
<dt class="optional">
|
|
103
|
+
mask
|
|
104
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-mask"
|
|
105
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
106
|
+
<span class="property-type">string</span>
|
|
107
|
+
</dt>
|
|
108
|
+
<dd>
|
|
109
|
+
An additional image whose fully transparent areas (e.g. where alpha is
|
|
110
|
+
zero) indicate where image should be edited.
|
|
111
|
+
</dd>
|
|
112
|
+
<dt class="optional">
|
|
113
|
+
model
|
|
114
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-model"
|
|
115
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
116
|
+
<span class="property-type"></span>
|
|
117
|
+
</dt>
|
|
118
|
+
<dd>The model to use for image generation.</dd>
|
|
119
|
+
<dt class="optional">
|
|
120
|
+
n
|
|
121
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-n"
|
|
122
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
123
|
+
<span class="property-type">integer</span>
|
|
124
|
+
</dt>
|
|
125
|
+
<dd>The number of images to generate. Must be between 1 and 10.</dd>
|
|
126
|
+
<dt class="optional">
|
|
127
|
+
size
|
|
128
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-size"
|
|
129
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
130
|
+
<span class="property-type">string</span>
|
|
131
|
+
</dt>
|
|
132
|
+
<dd>The size of the generated images.</dd>
|
|
133
|
+
<dt class="optional">
|
|
134
|
+
response_format
|
|
135
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-response_format"
|
|
136
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
137
|
+
<span class="property-type">string</span>
|
|
138
|
+
</dt>
|
|
139
|
+
<dd>
|
|
140
|
+
The format in which the generated images are returned. Must be one of
|
|
141
|
+
url or b64_json.
|
|
142
|
+
</dd>
|
|
143
|
+
<dt class="optional">
|
|
144
|
+
user
|
|
145
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createEdit#images-createedit-user"
|
|
146
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
147
|
+
<span class="property-type">string</span>
|
|
148
|
+
</dt>
|
|
149
|
+
<dd>
|
|
150
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
151
|
+
monitor and detect abuse.
|
|
152
|
+
</dd>
|
|
153
|
+
</dl>
|
|
154
|
+
|
|
155
|
+
<h4 style="font-weight: bolder;"> ⋙ Create Image Variation</h4>
|
|
156
|
+
<p>Creates a variation of a given image.</p>
|
|
157
|
+
<dl class="message-properties">
|
|
158
|
+
<h4>msg.payload Properties</h4>
|
|
159
|
+
|
|
160
|
+
<dt>
|
|
161
|
+
image
|
|
162
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createVariation#images-createvariation-image"
|
|
163
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
164
|
+
<span class="property-type">string</span>
|
|
165
|
+
</dt>
|
|
166
|
+
<dd>The image to use as the basis for the variation(s).</dd>
|
|
167
|
+
<dt>
|
|
168
|
+
model
|
|
169
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createVariation#images-createvariation-model"
|
|
170
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
171
|
+
<span class="property-type"></span>
|
|
172
|
+
</dt>
|
|
173
|
+
<dd>The model to use for image generation.</dd>
|
|
174
|
+
<dt>
|
|
175
|
+
n
|
|
176
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createVariation#images-createvariation-n"
|
|
177
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
178
|
+
<span class="property-type">integer</span>
|
|
179
|
+
</dt>
|
|
180
|
+
<dd>The number of images to generate.</dd>
|
|
181
|
+
<dt>
|
|
182
|
+
response_format
|
|
183
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createVariation#images-createvariation-response_format"
|
|
184
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
185
|
+
<span class="property-type">string</span>
|
|
186
|
+
</dt>
|
|
187
|
+
<dd>The format in which the generated images are returned.</dd>
|
|
188
|
+
<dt>
|
|
189
|
+
size
|
|
190
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createVariation#images-createvariation-size"
|
|
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>The size of the generated images.</dd>
|
|
195
|
+
<dt>
|
|
196
|
+
user
|
|
197
|
+
<a href="https://platform.openai.com/docs/api-reference/images/createVariation#images-createvariation-user"
|
|
198
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
199
|
+
<span class="property-type">string</span>
|
|
200
|
+
</dt>
|
|
201
|
+
<dd>
|
|
202
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
203
|
+
monitor and detect abuse.
|
|
204
|
+
</dd>
|
|
205
|
+
</dl>
|
|
206
|
+
|
|
207
|
+
</details>
|
|
208
|
+
</section>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
async function createImage(parameters) {
|
|
5
|
+
const openai = new OpenAI(this.clientParams);
|
|
6
|
+
const response = await openai.images.generate(parameters.payload);
|
|
7
|
+
|
|
8
|
+
return response.data;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function createImageEdit(parameters) {
|
|
12
|
+
const openai = new OpenAI(this.clientParams);
|
|
13
|
+
let { image, mask, ...params } = parameters.payload;
|
|
14
|
+
|
|
15
|
+
params.image = fs.createReadStream(image);
|
|
16
|
+
if (mask) {
|
|
17
|
+
params.mask = fs.createReadStream(mask);
|
|
18
|
+
}
|
|
19
|
+
const response = await openai.images.edit(params);
|
|
20
|
+
|
|
21
|
+
return response.data;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function createImageVariation(parameters) {
|
|
25
|
+
const openai = new OpenAI(this.clientParams);
|
|
26
|
+
let { image, ...params } = parameters.payload;
|
|
27
|
+
|
|
28
|
+
params.image = fs.createReadStream(image);
|
|
29
|
+
const response = await openai.images.createVariation(params);
|
|
30
|
+
|
|
31
|
+
return response.data;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
createImage,
|
|
36
|
+
createImageEdit,
|
|
37
|
+
createImageVariation,
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="🖼️ Images">
|
|
2
|
+
<option
|
|
3
|
+
value="createImage"
|
|
4
|
+
data-i18n="OpenaiApi.parameters.createImage"
|
|
5
|
+
></option>
|
|
6
|
+
<option
|
|
7
|
+
value="createImageEdit"
|
|
8
|
+
data-i18n="OpenaiApi.parameters.createImageEdit"
|
|
9
|
+
></option>
|
|
10
|
+
<option
|
|
11
|
+
value="createImageVariation"
|
|
12
|
+
data-i18n="OpenaiApi.parameters.createImageVariation"
|
|
13
|
+
></option>
|
|
14
|
+
</optgroup>
|
package/src/lib.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assistants = require("./assistants/methods.js");
|
|
4
|
+
const audio = require("./audio/methods.js");
|
|
5
|
+
const batch = require("./batch/methods.js");
|
|
6
|
+
const chat = require("./chat/methods.js");
|
|
7
|
+
const container_files = require("./container-files/methods.js");
|
|
8
|
+
const containers = require("./containers/methods.js");
|
|
9
|
+
const embeddings = require("./embeddings/methods.js");
|
|
10
|
+
const files = require("./files/methods.js");
|
|
11
|
+
const fine_tuning = require("./fine-tuning/methods.js");
|
|
12
|
+
const images = require("./images/methods.js");
|
|
13
|
+
const messages = require("./messages/methods.js");
|
|
14
|
+
const models = require("./models/methods.js");
|
|
15
|
+
const moderations = require("./moderations/methods.js");
|
|
16
|
+
const responses = require("./responses/methods.js");
|
|
17
|
+
const runs = require("./runs/methods.js");
|
|
18
|
+
const threads = require("./threads/methods.js");
|
|
19
|
+
const uploads = require("./uploads/methods.js");
|
|
20
|
+
const vectorStoreFileBatches = require("./vector-store-file-batches/methods.js");
|
|
21
|
+
const vectorStoreFiles = require("./vector-store-files/methods.js");
|
|
22
|
+
const vectorStores = require("./vector-stores/methods.js");
|
|
23
|
+
|
|
24
|
+
class OpenaiApi {
|
|
25
|
+
constructor(apiKey, baseURL, organization) {
|
|
26
|
+
this.clientParams = {
|
|
27
|
+
apiKey,
|
|
28
|
+
baseURL,
|
|
29
|
+
organization,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Attach all exported methods as instance methods
|
|
35
|
+
Object.assign(
|
|
36
|
+
OpenaiApi.prototype,
|
|
37
|
+
assistants,
|
|
38
|
+
audio,
|
|
39
|
+
batch,
|
|
40
|
+
chat,
|
|
41
|
+
container_files,
|
|
42
|
+
containers,
|
|
43
|
+
embeddings,
|
|
44
|
+
files,
|
|
45
|
+
fine_tuning,
|
|
46
|
+
images,
|
|
47
|
+
messages,
|
|
48
|
+
models,
|
|
49
|
+
moderations,
|
|
50
|
+
responses,
|
|
51
|
+
runs,
|
|
52
|
+
threads,
|
|
53
|
+
uploads,
|
|
54
|
+
vectorStoreFileBatches,
|
|
55
|
+
vectorStoreFiles,
|
|
56
|
+
vectorStores
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// Export the class
|
|
60
|
+
module.exports = OpenaiApi;
|