@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.
- package/README.md +11 -15
- package/examples/responses/mcp.json +87 -0
- package/gulpfile.js +15 -0
- package/lib.js +16375 -539
- package/locales/en-US/node.json +9 -0
- package/node.html +3037 -3839
- 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 +58 -0
- package/src/messages/help.html +174 -0
- package/src/messages/methods.js +48 -0
- package/src/messages/template.html +18 -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 +59 -0
- package/src/vector-store-files/template.html +18 -0
- package/src/vector-stores/help.html +162 -0
- package/src/vector-stores/methods.js +54 -0
- package/src/vector-stores/template.html +22 -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,144 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🗄️ Container Files</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files" target="_blank">Official Documentation
|
|
5
|
+
<i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
6
|
+
|
|
7
|
+
<h4 style="font-weight: bolder;"> ⋙ Create Container File</h4>
|
|
8
|
+
<p>Create a container file.</p>
|
|
9
|
+
<dl class="message-properties">
|
|
10
|
+
<h4>msg.payload Properties</h4>
|
|
11
|
+
|
|
12
|
+
<dt>
|
|
13
|
+
container_id
|
|
14
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/createContainerFile#container-files-createcontainerfile-container_id"
|
|
15
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
16
|
+
<span class="property-type">string</span>
|
|
17
|
+
</dt>
|
|
18
|
+
<dd>The ID of the container to hold the file.</dd>
|
|
19
|
+
|
|
20
|
+
<dt class="optional">
|
|
21
|
+
file
|
|
22
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/createContainerFile#container-files-createcontainerfile-file"
|
|
23
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
24
|
+
<span class="property-type">file</span>
|
|
25
|
+
</dt>
|
|
26
|
+
<dd>The File object (not file name) to be uploaded.</dd>
|
|
27
|
+
|
|
28
|
+
<dt class="optional">
|
|
29
|
+
file_id
|
|
30
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/createContainerFile#container-files-createcontainerfile-file_id"
|
|
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>Name of the file to create.</dd>
|
|
35
|
+
</dl>
|
|
36
|
+
|
|
37
|
+
<h4 style="font-weight: bolder;"> ⋙ List Container Files</h4>
|
|
38
|
+
<p>List container files.</p>
|
|
39
|
+
<dl class="message-properties">
|
|
40
|
+
<h4>msg.payload Properties</h4>
|
|
41
|
+
|
|
42
|
+
<dt>
|
|
43
|
+
container_id
|
|
44
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/listContainerFiles#container-files-listcontainerfiles-container_id"
|
|
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>The ID of the desired container.</dd>
|
|
49
|
+
|
|
50
|
+
<dt class="optional">
|
|
51
|
+
after
|
|
52
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/listContainerFiles#container-files-listcontainerfiles-after"
|
|
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>A cursor for use in pagination. `after` is an object ID that defines your place in the list.</dd>
|
|
57
|
+
|
|
58
|
+
<dt class="optional">
|
|
59
|
+
limit
|
|
60
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/listContainerFiles#container-files-listcontainerfiles-limit"
|
|
61
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
62
|
+
<span class="property-type">integer</span>
|
|
63
|
+
</dt>
|
|
64
|
+
<dd>A limit on the number of objects to be returned.</dd>
|
|
65
|
+
|
|
66
|
+
<dt class="optional">
|
|
67
|
+
order
|
|
68
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/listContainerFiles#container-files-listcontainerfiles-order"
|
|
69
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
70
|
+
<span class="property-type">string</span>
|
|
71
|
+
</dt>
|
|
72
|
+
<dd>Sort order by the created_at timestamp of the objects.</dd>
|
|
73
|
+
</dl>
|
|
74
|
+
|
|
75
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve Container File</h4>
|
|
76
|
+
<p>Retrieve a container file.</p>
|
|
77
|
+
<dl class="message-properties">
|
|
78
|
+
<h4>msg.payload Properties</h4>
|
|
79
|
+
|
|
80
|
+
<dt>
|
|
81
|
+
container_id
|
|
82
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/retrieveContainerFile#container-files-retrievecontainerfile-container_id"
|
|
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>The ID of the desired container.</dd>
|
|
87
|
+
|
|
88
|
+
<dt>
|
|
89
|
+
file_id
|
|
90
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/retrieveContainerFile#container-files-retrievecontainerfile-container_id"
|
|
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 ID of the file to retrieve.</dd>
|
|
95
|
+
</dl>
|
|
96
|
+
|
|
97
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve Container File Content</h4>
|
|
98
|
+
<p>Retrieves container file content.</p>
|
|
99
|
+
<dl class="message-properties">
|
|
100
|
+
<h4>msg.payload Properties</h4>
|
|
101
|
+
|
|
102
|
+
<dt>
|
|
103
|
+
container_id
|
|
104
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/retrieveContainerFileContent#container-files-retrievecontainerfilecontent-container_id"
|
|
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>The ID of the desired container.</dd>
|
|
109
|
+
|
|
110
|
+
<dt>
|
|
111
|
+
file_id
|
|
112
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/retrieveContainerFileContent#container-files-retrievecontainerfilecontent-file_id"
|
|
113
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
114
|
+
<span class="property-type">string</span>
|
|
115
|
+
</dt>
|
|
116
|
+
<dd>The ID of the desired file.</dd>
|
|
117
|
+
|
|
118
|
+
</dl>
|
|
119
|
+
|
|
120
|
+
<h4 style="font-weight: bolder;"> ⋙ Delete Container File</h4>
|
|
121
|
+
<p>Deletes a container file.</p>
|
|
122
|
+
<dl class="message-properties">
|
|
123
|
+
<h4>msg.payload Properties</h4>
|
|
124
|
+
|
|
125
|
+
<dt>
|
|
126
|
+
container_id
|
|
127
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/deleteContainerFile#container-files-deletecontainerfile-container_id"
|
|
128
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
129
|
+
<span class="property-type">string</span>
|
|
130
|
+
</dt>
|
|
131
|
+
<dd>The ID of the desired container.</dd>
|
|
132
|
+
|
|
133
|
+
<dt>
|
|
134
|
+
file_id
|
|
135
|
+
<a href="https://platform.openai.com/docs/api-reference/container-files/deleteContainerFile#container-files-deletecontainerfile-file_id"
|
|
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>The ID of the file to delete.</dd>
|
|
140
|
+
|
|
141
|
+
</dl>
|
|
142
|
+
|
|
143
|
+
</details>
|
|
144
|
+
</section>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
async function listContainerFiles(parameters) {
|
|
5
|
+
const openai = new OpenAI(this.clientParams);
|
|
6
|
+
const { container_id, ...params } = parameters.payload;
|
|
7
|
+
const list = await openai.containers.files.list(container_id, params);
|
|
8
|
+
return [...list.data];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function addContainerFile(parameters) {
|
|
12
|
+
const openai = new OpenAI(this.clientParams);
|
|
13
|
+
let { container_id, file, ...params } = parameters.payload;
|
|
14
|
+
if (file) {
|
|
15
|
+
params.file = fs.createReadStream(file);
|
|
16
|
+
}
|
|
17
|
+
const response = await openai.containers.files.create(container_id, params);
|
|
18
|
+
return response;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function retrieveContainerFile(parameters) {
|
|
22
|
+
const openai = new OpenAI(this.clientParams);
|
|
23
|
+
const { container_id, file_id, ...params } = parameters.payload;
|
|
24
|
+
const response = await openai.containers.files.retrieve(
|
|
25
|
+
container_id,
|
|
26
|
+
file_id,
|
|
27
|
+
params
|
|
28
|
+
);
|
|
29
|
+
return response;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function deleteContainerFile(parameters) {
|
|
33
|
+
const openai = new OpenAI(this.clientParams);
|
|
34
|
+
const { container_id, file_id, ...params } = parameters.payload;
|
|
35
|
+
const response = await openai.containers.files.del(
|
|
36
|
+
container_id,
|
|
37
|
+
file_id,
|
|
38
|
+
params
|
|
39
|
+
);
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function downloadContainerFileContent(parameters) {
|
|
44
|
+
const openai = new OpenAI(this.clientParams);
|
|
45
|
+
const { container_id, file_id, ...params } = parameters.payload;
|
|
46
|
+
const response = await openai.containers.files.content.retrieve(
|
|
47
|
+
container_id,
|
|
48
|
+
file_id,
|
|
49
|
+
params
|
|
50
|
+
);
|
|
51
|
+
return response;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = {
|
|
55
|
+
listContainerFiles,
|
|
56
|
+
addContainerFile,
|
|
57
|
+
retrieveContainerFile,
|
|
58
|
+
deleteContainerFile,
|
|
59
|
+
downloadContainerFileContent,
|
|
60
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="🗄️ Container Files">
|
|
2
|
+
<option value="listContainerFiles" data-i18n="OpenaiApi.parameters.listContainerFiles"></option>
|
|
3
|
+
<option value="addContainerFile" data-i18n="OpenaiApi.parameters.addContainerFile"></option>
|
|
4
|
+
<option value="retrieveContainerFile" data-i18n="OpenaiApi.parameters.retrieveContainerFile"></option>
|
|
5
|
+
<option value="deleteContainerFile" data-i18n="OpenaiApi.parameters.deleteContainerFile"></option>
|
|
6
|
+
<option value="downloadContainerFileContent" data-i18n="OpenaiApi.parameters.downloadContainerFileContent"></option>
|
|
7
|
+
</optgroup>
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🫙 Containers</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/containers" target="_blank">Official Documentation
|
|
5
|
+
<i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
6
|
+
|
|
7
|
+
<h4 style="font-weight: bolder;"> ⋙ Create Container</h4>
|
|
8
|
+
<p>Create and manage containers for use with the Code Interpreter tool.</p>
|
|
9
|
+
<dl class="message-properties">
|
|
10
|
+
<h4>msg.payload Properties</h4>
|
|
11
|
+
|
|
12
|
+
<dt>
|
|
13
|
+
name
|
|
14
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/createContainers#containers-createcontainers-name"
|
|
15
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
16
|
+
<span class="property-type">string</span>
|
|
17
|
+
</dt>
|
|
18
|
+
<dd>Name of the container to create.</dd>
|
|
19
|
+
|
|
20
|
+
<dt class="optional">
|
|
21
|
+
expires_after
|
|
22
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/createContainers#containers-createcontainers-expires_after"
|
|
23
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
24
|
+
<span class="property-type">object</span>
|
|
25
|
+
</dt>
|
|
26
|
+
<dd>Container expiration time in seconds relative to the 'anchor' time.</dd>
|
|
27
|
+
|
|
28
|
+
<dt class="optional">
|
|
29
|
+
file_ids
|
|
30
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/createContainers#containers-createcontainers-file_ids"
|
|
31
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
32
|
+
<span class="property-type">array</span>
|
|
33
|
+
</dt>
|
|
34
|
+
<dd>IDs of files to copy to the container.</dd>
|
|
35
|
+
</dl>
|
|
36
|
+
|
|
37
|
+
<h4 style="font-weight: bolder;"> ⋙ List Containers</h4>
|
|
38
|
+
<p>List Containers</p>
|
|
39
|
+
<dl class="message-properties">
|
|
40
|
+
<h4>msg.payload Properties</h4>
|
|
41
|
+
|
|
42
|
+
<dt class="optional">
|
|
43
|
+
after
|
|
44
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/listContainers#containers-listcontainers-after"
|
|
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. after is an object ID that defines your place in the list.</dd>
|
|
49
|
+
|
|
50
|
+
<dt class="optional">
|
|
51
|
+
limit
|
|
52
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/listContainers#containers-listcontainers-limit"
|
|
53
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
54
|
+
<span class="property-type">integer</span>
|
|
55
|
+
</dt>
|
|
56
|
+
<dd>A limit on the number of objects to be returned.</dd>
|
|
57
|
+
|
|
58
|
+
<dt class="optional">
|
|
59
|
+
order
|
|
60
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/listContainers#containers-listcontainers-order"
|
|
61
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
62
|
+
<span class="property-type">string</span>
|
|
63
|
+
</dt>
|
|
64
|
+
<dd>Sort order by the created_at timestamp of the objects.</dd>
|
|
65
|
+
</dl>
|
|
66
|
+
|
|
67
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve Container</h4>
|
|
68
|
+
<p>Retrieve container.</p>
|
|
69
|
+
<dl class="message-properties">
|
|
70
|
+
<h4>msg.payload Properties</h4>
|
|
71
|
+
|
|
72
|
+
<dt>
|
|
73
|
+
container_id
|
|
74
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/retrieveContainer#containers-retrievecontainer-container_id"
|
|
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 ID of the container to retrieve.</dd>
|
|
79
|
+
</dl>
|
|
80
|
+
|
|
81
|
+
<h4 style="font-weight: bolder;"> ⋙ Delete Container</h4>
|
|
82
|
+
<p>Delete container.</p>
|
|
83
|
+
<dl class="message-properties">
|
|
84
|
+
<h4>msg.payload Properties</h4>
|
|
85
|
+
|
|
86
|
+
<dt>
|
|
87
|
+
container_id
|
|
88
|
+
<a href="https://platform.openai.com/docs/api-reference/containers/deleteContainer#containers-deletecontainer-container_id"
|
|
89
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
90
|
+
<span class="property-type">string</span>
|
|
91
|
+
</dt>
|
|
92
|
+
<dd>The ID of the container to delete.</dd>
|
|
93
|
+
</dl>
|
|
94
|
+
|
|
95
|
+
</details>
|
|
96
|
+
</section>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
|
|
3
|
+
async function listContainers(parameters) {
|
|
4
|
+
const openai = new OpenAI(this.clientParams);
|
|
5
|
+
const list = await openai.containers.list(parameters.payload);
|
|
6
|
+
return [...list.data];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async function createContainer(parameters) {
|
|
10
|
+
const openai = new OpenAI(this.clientParams);
|
|
11
|
+
const response = await openai.containers.create(parameters.payload);
|
|
12
|
+
return response;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function retrieveContainer(parameters) {
|
|
16
|
+
const openai = new OpenAI(this.clientParams);
|
|
17
|
+
const { container_id, ...params } = parameters.payload;
|
|
18
|
+
const response = await openai.containers.retrieve(container_id, params);
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function deleteContainer(parameters) {
|
|
23
|
+
const openai = new OpenAI(this.clientParams);
|
|
24
|
+
const { container_id, ...params } = parameters.payload;
|
|
25
|
+
const response = await openai.containers.del(container_id, params);
|
|
26
|
+
return response;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = {
|
|
30
|
+
createContainer,
|
|
31
|
+
listContainers,
|
|
32
|
+
retrieveContainer,
|
|
33
|
+
deleteContainer,
|
|
34
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="🫙 Containers">
|
|
2
|
+
<option value="listContainers" data-i18n="OpenaiApi.parameters.listContainers"></option>
|
|
3
|
+
<option value="createContainer" data-i18n="OpenaiApi.parameters.createContainer"></option>
|
|
4
|
+
<option value="retrieveContainer" data-i18n="OpenaiApi.parameters.retrieveContainer"></option>
|
|
5
|
+
<option value="deleteContainer" data-i18n="OpenaiApi.parameters.deleteContainer"></option>
|
|
6
|
+
</optgroup>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">🔗 Embeddings</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/embeddings" 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 Embeddings</h4>
|
|
7
|
+
<p>Creates an embedding vector representing the input text.</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/embeddings/create#embeddings-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>Input text to embed, encoded as a string or array of tokens.</dd>
|
|
18
|
+
<dt>
|
|
19
|
+
model
|
|
20
|
+
<a href="https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-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>ID of the model to use.</dd>
|
|
25
|
+
<dt class="optional">
|
|
26
|
+
encoding_format
|
|
27
|
+
<a href="https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-encoding_format"
|
|
28
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
29
|
+
<span class="property-type">string</span>
|
|
30
|
+
</dt>
|
|
31
|
+
<dd>
|
|
32
|
+
The format to return the embeddings in. Can be either float or base64.
|
|
33
|
+
</dd>
|
|
34
|
+
<dt class="optional">
|
|
35
|
+
dimensions
|
|
36
|
+
<a href="https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-dimensions"
|
|
37
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
38
|
+
<span class="property-type">integer</span>
|
|
39
|
+
</dt>
|
|
40
|
+
<dd>
|
|
41
|
+
The number of dimensions the resulting output embeddings should have.
|
|
42
|
+
Only supported in text-embedding-3 and later models.
|
|
43
|
+
</dd>
|
|
44
|
+
<dt class="optional">
|
|
45
|
+
user
|
|
46
|
+
<a href="https://platform.openai.com/docs/api-reference/embeddings/create#embeddings-create-user"
|
|
47
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
48
|
+
<span class="property-type">string</span>
|
|
49
|
+
</dt>
|
|
50
|
+
<dd>
|
|
51
|
+
A unique identifier representing your end-user, which can help OpenAI to
|
|
52
|
+
monitor and detect abuse.
|
|
53
|
+
</dd>
|
|
54
|
+
</dl>
|
|
55
|
+
|
|
56
|
+
</details>
|
|
57
|
+
</section>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
|
|
3
|
+
async function createEmbedding(parameters) {
|
|
4
|
+
const openai = new OpenAI(this.clientParams);
|
|
5
|
+
const response = await openai.embeddings.create(parameters.payload);
|
|
6
|
+
|
|
7
|
+
return response.data;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
createEmbedding,
|
|
12
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<section>
|
|
2
|
+
<details>
|
|
3
|
+
<summary style="font-weight: bold;">📁 Files</summary>
|
|
4
|
+
<a href="https://platform.openai.com/docs/api-reference/files" 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 Files</h4>
|
|
7
|
+
<p>Returns a list of files that belong to the user's organization.</p>
|
|
8
|
+
<dl class="message-properties">
|
|
9
|
+
<h4>msg.payload Properties</h4>
|
|
10
|
+
|
|
11
|
+
<dt class="optional">
|
|
12
|
+
purpose
|
|
13
|
+
<a href="https://platform.openai.com/docs/api-reference/files/list#files-list-purpose"
|
|
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>Only return files with the given purpose.</dd>
|
|
18
|
+
|
|
19
|
+
<dt class="optional">
|
|
20
|
+
limit
|
|
21
|
+
<a href="https://platform.openai.com/docs/api-reference/files/list#files-list-limit" target="_blank"><i
|
|
22
|
+
class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
23
|
+
<span class="property-type">integer</span>
|
|
24
|
+
</dt>
|
|
25
|
+
<dd>A limit on the number of objects to be returned.</dd>
|
|
26
|
+
|
|
27
|
+
<dt class="optional">
|
|
28
|
+
order
|
|
29
|
+
<a href="https://platform.openai.com/docs/api-reference/files/list#files-list-order" target="_blank"><i
|
|
30
|
+
class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
31
|
+
<span class="property-type">string</span>
|
|
32
|
+
</dt>
|
|
33
|
+
<dd>Sort order by the created_at timestamp of the objects.</dd>
|
|
34
|
+
|
|
35
|
+
<dt class="optional">
|
|
36
|
+
after
|
|
37
|
+
<a href="https://platform.openai.com/docs/api-reference/files/list#files-list-after" target="_blank"><i
|
|
38
|
+
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
|
+
</dl>
|
|
43
|
+
|
|
44
|
+
<h4 style="font-weight: bolder;"> ⋙ Upload File</h4>
|
|
45
|
+
<dl class="message-properties">
|
|
46
|
+
<h4>msg.payload Properties</h4>
|
|
47
|
+
|
|
48
|
+
<dt>
|
|
49
|
+
file
|
|
50
|
+
<a href="https://platform.openai.com/docs/api-reference/files/create#files-create-file"
|
|
51
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
52
|
+
<span class="property-type">file</span>
|
|
53
|
+
</dt>
|
|
54
|
+
<dd>Absolute path to the file that's being uploaded.</dd>
|
|
55
|
+
<dt>
|
|
56
|
+
purpose
|
|
57
|
+
<a href="https://platform.openai.com/docs/api-reference/files/create#files-create-purpose"
|
|
58
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
59
|
+
<span class="property-type">string</span>
|
|
60
|
+
</dt>
|
|
61
|
+
<dd>The intended purpose of the uploaded file.</dd>
|
|
62
|
+
</dl>
|
|
63
|
+
|
|
64
|
+
<h4 style="font-weight: bolder;"> ⋙ Delete File</h4>
|
|
65
|
+
<p>Delete a file.</p>
|
|
66
|
+
<dl class="message-properties">
|
|
67
|
+
<h4>msg.payload Properties</h4>
|
|
68
|
+
|
|
69
|
+
<dt>file_id <span class="property-type">string</span></dt>
|
|
70
|
+
<dd>The ID of the file to use for this request.</dd>
|
|
71
|
+
</dl>
|
|
72
|
+
|
|
73
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve File</h4>
|
|
74
|
+
<p>Returns information about a specific file.</p>
|
|
75
|
+
<dl class="message-properties">
|
|
76
|
+
<h4>msg.payload Properties</h4>
|
|
77
|
+
|
|
78
|
+
<dt>
|
|
79
|
+
file_id
|
|
80
|
+
<a href="https://platform.openai.com/docs/api-reference/files/delete#files-delete-file_id"
|
|
81
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
82
|
+
<span class="property-type">string</span>
|
|
83
|
+
</dt>
|
|
84
|
+
<dd>The ID of the file to use for this request.</dd>
|
|
85
|
+
</dl>
|
|
86
|
+
|
|
87
|
+
<h4 style="font-weight: bolder;"> ⋙ Retrieve File Content</h4>
|
|
88
|
+
<p>Returns the contents of the specified file.</p>
|
|
89
|
+
<dl class="message-properties">
|
|
90
|
+
<h4>msg.payload Properties</h4>
|
|
91
|
+
|
|
92
|
+
<dt>
|
|
93
|
+
file_id
|
|
94
|
+
<a href="https://platform.openai.com/docs/api-reference/files/retrieve-contents#files-retrieve-contents-file_id"
|
|
95
|
+
target="_blank"><i class="fa fa-external-link fa-sm" aria-hidden="true"></i></a>
|
|
96
|
+
<span class="property-type">string</span>
|
|
97
|
+
</dt>
|
|
98
|
+
<dd>The ID of the file to use for this request.</dd>
|
|
99
|
+
</dl>
|
|
100
|
+
|
|
101
|
+
</details>
|
|
102
|
+
</section>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const OpenAI = require("openai").OpenAI;
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
|
|
4
|
+
async function listFiles(parameters) {
|
|
5
|
+
const openai = new OpenAI(this.clientParams);
|
|
6
|
+
const list = await openai.files.list(parameters.payload);
|
|
7
|
+
|
|
8
|
+
return [...list.data];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async function createFile(parameters) {
|
|
12
|
+
const openai = new OpenAI(this.clientParams);
|
|
13
|
+
let { file, ...params } = parameters.payload;
|
|
14
|
+
|
|
15
|
+
params.file = fs.createReadStream(file);
|
|
16
|
+
|
|
17
|
+
const response = await openai.files.create(params);
|
|
18
|
+
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function deleteFile(parameters) {
|
|
23
|
+
const openai = new OpenAI(this.clientParams);
|
|
24
|
+
const { file_id, ...params } = parameters.payload;
|
|
25
|
+
const response = await openai.files.del(file_id, params);
|
|
26
|
+
|
|
27
|
+
return response;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function retrieveFile(parameters) {
|
|
31
|
+
const openai = new OpenAI(this.clientParams);
|
|
32
|
+
const { file_id, ...params } = parameters.payload;
|
|
33
|
+
const response = await openai.files.retrieve(file_id, params);
|
|
34
|
+
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function downloadFile(parameters) {
|
|
39
|
+
const openai = new OpenAI(this.clientParams);
|
|
40
|
+
const { file_id, ...params } = parameters.payload;
|
|
41
|
+
const response = await openai.files.content(file_id, params);
|
|
42
|
+
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
listFiles,
|
|
48
|
+
createFile,
|
|
49
|
+
deleteFile,
|
|
50
|
+
retrieveFile,
|
|
51
|
+
downloadFile,
|
|
52
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<optgroup style="font-style: normal;" label="📁 Files">
|
|
2
|
+
<option
|
|
3
|
+
value="listFiles"
|
|
4
|
+
data-i18n="OpenaiApi.parameters.listFiles"
|
|
5
|
+
></option>
|
|
6
|
+
<option
|
|
7
|
+
value="createFile"
|
|
8
|
+
data-i18n="OpenaiApi.parameters.uploadFile"
|
|
9
|
+
></option>
|
|
10
|
+
<option
|
|
11
|
+
value="deleteFile"
|
|
12
|
+
data-i18n="OpenaiApi.parameters.deleteFile"
|
|
13
|
+
></option>
|
|
14
|
+
<option
|
|
15
|
+
value="retrieveFile"
|
|
16
|
+
data-i18n="OpenaiApi.parameters.retrieveFile"
|
|
17
|
+
></option>
|
|
18
|
+
<option
|
|
19
|
+
value="downloadFile"
|
|
20
|
+
data-i18n="OpenaiApi.parameters.downloadFile"
|
|
21
|
+
></option>
|
|
22
|
+
</optgroup>
|