@pipedream/openai 0.1.9 → 0.2.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/actions/cancel-run/cancel-run.mjs +33 -0
- package/actions/chat/chat.mjs +9 -2
- package/actions/classify-items-into-categories/classify-items-into-categories.mjs +1 -1
- package/actions/common/common-helper.mjs +1 -1
- package/actions/common/common.mjs +25 -11
- package/actions/common/lang.mjs +16 -16
- package/actions/create-assistant/create-assistant.mjs +71 -0
- package/actions/create-embeddings/create-embeddings.mjs +2 -2
- package/actions/create-image/create-image.mjs +55 -2
- package/actions/create-message/create-message.mjs +64 -0
- package/actions/create-run/create-run.mjs +64 -0
- package/actions/create-thread/create-thread.mjs +36 -0
- package/actions/create-thread-and-run/create-thread-and-run.mjs +61 -0
- package/actions/create-transcription/create-transcription.mjs +2 -3
- package/actions/delete-file/delete-file.mjs +26 -0
- package/actions/list-files/list-files.mjs +26 -0
- package/actions/list-messages/list-messages.mjs +54 -0
- package/actions/list-run-steps/list-run-steps.mjs +65 -0
- package/actions/list-runs/list-runs.mjs +68 -0
- package/actions/modify-assistant/modify-assistant.mjs +82 -0
- package/actions/modify-message/modify-message.mjs +42 -0
- package/actions/modify-run/modify-run.mjs +42 -0
- package/actions/retrieve-file/retrieve-file.mjs +26 -0
- package/actions/retrieve-file-content/retrieve-file-content.mjs +25 -0
- package/actions/retrieve-run/retrieve-run.mjs +33 -0
- package/actions/retrieve-run-step/retrieve-run-step.mjs +40 -0
- package/actions/send-prompt/send-prompt.mjs +2 -2
- package/actions/submit-tool-outputs-to-run/submit-tool-outputs-to-run.mjs +41 -0
- package/actions/summarize/summarize.mjs +1 -1
- package/actions/translate-text/translate-text.mjs +1 -1
- package/actions/upload-file/upload-file.mjs +41 -0
- package/openai.app.mjs +627 -0
- package/package.json +1 -1
- package/app/openai.app.mjs +0 -180
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-list-files",
|
|
5
|
+
name: "List Files",
|
|
6
|
+
description: "Returns a list of files that belong to the user's organization. [See the documentation](https://platform.openai.com/docs/api-reference/files/list)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
purpose: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"purpose",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
async run({ $ }) {
|
|
19
|
+
const response = await this.openai.listFiles({
|
|
20
|
+
purpose: this.purpose,
|
|
21
|
+
});
|
|
22
|
+
const summary = `Successfully listed ${response.length} files`;
|
|
23
|
+
$.export("$summary", summary);
|
|
24
|
+
return response;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-list-messages",
|
|
5
|
+
name: "List Messages",
|
|
6
|
+
description: "Lists the messages for a given thread. [See the documentation](https://platform.openai.com/docs/api-reference)",
|
|
7
|
+
version: "0.0.2",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
limit: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"limit",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
order: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
openai,
|
|
26
|
+
"order",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
after: {
|
|
30
|
+
propDefinition: [
|
|
31
|
+
openai,
|
|
32
|
+
"after",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
before: {
|
|
36
|
+
propDefinition: [
|
|
37
|
+
openai,
|
|
38
|
+
"before",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
async run({ $ }) {
|
|
43
|
+
const response = await this.openai.listMessages({
|
|
44
|
+
threadId: this.threadId,
|
|
45
|
+
limit: this.limit,
|
|
46
|
+
order: this.order,
|
|
47
|
+
after: this.after,
|
|
48
|
+
before: this.before,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
$.export("$summary", `Successfully listed ${response.data.length} messages for thread ID ${this.threadId}`);
|
|
52
|
+
return response.data;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-list-run-steps",
|
|
5
|
+
name: "List Run Steps",
|
|
6
|
+
description: "Returns a list of run steps belonging to a run. [See the documentation](https://platform.openai.com/docs/api-reference/runs/list-run-steps)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
runId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"runId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
limit: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
openai,
|
|
26
|
+
"limit",
|
|
27
|
+
],
|
|
28
|
+
optional: true,
|
|
29
|
+
},
|
|
30
|
+
order: {
|
|
31
|
+
propDefinition: [
|
|
32
|
+
openai,
|
|
33
|
+
"order",
|
|
34
|
+
],
|
|
35
|
+
optional: true,
|
|
36
|
+
},
|
|
37
|
+
after: {
|
|
38
|
+
propDefinition: [
|
|
39
|
+
openai,
|
|
40
|
+
"after",
|
|
41
|
+
],
|
|
42
|
+
optional: true,
|
|
43
|
+
},
|
|
44
|
+
before: {
|
|
45
|
+
propDefinition: [
|
|
46
|
+
openai,
|
|
47
|
+
"before",
|
|
48
|
+
],
|
|
49
|
+
optional: true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
async run({ $ }) {
|
|
53
|
+
const response = await this.openai.listRunSteps({
|
|
54
|
+
threadId: this.threadId,
|
|
55
|
+
runId: this.runId,
|
|
56
|
+
limit: this.limit,
|
|
57
|
+
order: this.order,
|
|
58
|
+
after: this.after,
|
|
59
|
+
before: this.before,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
$.export("$summary", `Successfully listed run steps for run ${this.runId}`);
|
|
63
|
+
return response;
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-list-runs",
|
|
5
|
+
name: "List Runs",
|
|
6
|
+
description: "Returns a list of runs belonging to a thread. [See the documentation](https://platform.openai.com/docs/api-reference/runs/list)",
|
|
7
|
+
version: "0.0.2",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
limit: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"limit",
|
|
21
|
+
],
|
|
22
|
+
optional: true,
|
|
23
|
+
},
|
|
24
|
+
order: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
openai,
|
|
27
|
+
"order",
|
|
28
|
+
],
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
after: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
openai,
|
|
34
|
+
"after",
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
before: {
|
|
38
|
+
propDefinition: [
|
|
39
|
+
openai,
|
|
40
|
+
"before",
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
async run({ $ }) {
|
|
45
|
+
const params = {
|
|
46
|
+
...(this.limit && {
|
|
47
|
+
limit: this.limit,
|
|
48
|
+
}),
|
|
49
|
+
...(this.order && {
|
|
50
|
+
order: this.order,
|
|
51
|
+
}),
|
|
52
|
+
...(this.after && {
|
|
53
|
+
after: this.after,
|
|
54
|
+
}),
|
|
55
|
+
...(this.before && {
|
|
56
|
+
before: this.before,
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const response = await this.openai.listRuns({
|
|
61
|
+
threadId: this.threadId,
|
|
62
|
+
...params,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
$.export("$summary", `Successfully retrieved runs for thread ${this.threadId}`);
|
|
66
|
+
return response;
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-modify-assistant",
|
|
5
|
+
name: "Modify an Assistant",
|
|
6
|
+
description: "Modifies an existing OpenAI assistant. [See the documentation](https://platform.openai.com/docs/api-reference/assistants/modifyAssistant)",
|
|
7
|
+
version: "0.0.{{ts}}",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
assistant: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"assistant",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
model: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"assistantModel",
|
|
21
|
+
],
|
|
22
|
+
optional: true,
|
|
23
|
+
},
|
|
24
|
+
name: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
openai,
|
|
27
|
+
"name",
|
|
28
|
+
],
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
description: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
openai,
|
|
34
|
+
"description",
|
|
35
|
+
],
|
|
36
|
+
optional: true,
|
|
37
|
+
},
|
|
38
|
+
instructions: {
|
|
39
|
+
propDefinition: [
|
|
40
|
+
openai,
|
|
41
|
+
"instructions",
|
|
42
|
+
],
|
|
43
|
+
optional: true,
|
|
44
|
+
},
|
|
45
|
+
tools: {
|
|
46
|
+
propDefinition: [
|
|
47
|
+
openai,
|
|
48
|
+
"tools",
|
|
49
|
+
],
|
|
50
|
+
optional: true,
|
|
51
|
+
},
|
|
52
|
+
file_ids: {
|
|
53
|
+
propDefinition: [
|
|
54
|
+
openai,
|
|
55
|
+
"file_ids",
|
|
56
|
+
],
|
|
57
|
+
optional: true,
|
|
58
|
+
},
|
|
59
|
+
metadata: {
|
|
60
|
+
propDefinition: [
|
|
61
|
+
openai,
|
|
62
|
+
"metadata",
|
|
63
|
+
],
|
|
64
|
+
optional: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
async run({ $ }) {
|
|
68
|
+
const response = await this.openai.modifyAssistant({
|
|
69
|
+
$,
|
|
70
|
+
assistant: this.assistant,
|
|
71
|
+
model: this.model,
|
|
72
|
+
name: this.name,
|
|
73
|
+
description: this.description,
|
|
74
|
+
instructions: this.instructions,
|
|
75
|
+
tools: this.tools,
|
|
76
|
+
file_ids: this.file_ids,
|
|
77
|
+
metadata: this.metadata,
|
|
78
|
+
});
|
|
79
|
+
$.export("$summary", `Successfully modified assistant ${this.assistant}`);
|
|
80
|
+
return response;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-modify-message",
|
|
5
|
+
name: "Modify Message",
|
|
6
|
+
description: "Modifies an existing message in a thread. [See the documentation](https://platform.openai.com/docs/api-reference)",
|
|
7
|
+
version: "0.0.2",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
messageId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"messageId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
metadata: {
|
|
24
|
+
type: "string",
|
|
25
|
+
label: "Metadata",
|
|
26
|
+
description: "Metadata for the message in JSON string format",
|
|
27
|
+
optional: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const response = await this.openai.modifyMessage({
|
|
32
|
+
threadId: this.threadId,
|
|
33
|
+
messageId: this.messageId,
|
|
34
|
+
metadata: this.metadata
|
|
35
|
+
? JSON.parse(this.metadata)
|
|
36
|
+
: undefined,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
$.export("$summary", `Successfully modified message ${this.messageId} in thread ${this.threadId}`);
|
|
40
|
+
return response;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-modify-run",
|
|
5
|
+
name: "Modify Run",
|
|
6
|
+
description: "Modifies an existing run. [See the documentation](https://platform.openai.com/docs/api-reference)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
runId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"runId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
metadata: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
openai,
|
|
26
|
+
"metadata",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const response = await this.openai.modifyRun({
|
|
32
|
+
threadId: this.threadId,
|
|
33
|
+
runId: this.runId,
|
|
34
|
+
...(this.metadata && {
|
|
35
|
+
metadata: this.metadata,
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
$.export("$summary", `Successfully modified run with ID: ${this.runId}`);
|
|
40
|
+
return response;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-retrieve-file",
|
|
5
|
+
name: "Retrieve File",
|
|
6
|
+
description: "Retrieves a specific file from OpenAI. [See the documentation](https://platform.openai.com/docs/api-reference/files/retrieve)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
file_id: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"file_id",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
async run({ $ }) {
|
|
19
|
+
const response = await this.openai.retrieveFile({
|
|
20
|
+
file_id: this.file_id,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
$.export("$summary", `Successfully retrieved file with ID ${this.file_id}`);
|
|
24
|
+
return response;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-retrieve-file-content",
|
|
5
|
+
name: "Retrieve File Content",
|
|
6
|
+
description: "Retrieves the contents of the specified file. [See the documentation](https://platform.openai.com/docs/api-reference/files/retrieve-content)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
file_id: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"file_id",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
async run({ $ }) {
|
|
19
|
+
const response = await this.openai.retrieveFileContent({
|
|
20
|
+
file_id: this.file_id,
|
|
21
|
+
});
|
|
22
|
+
$.export("$summary", `Successfully retrieved file content with ID ${this.file_id}`);
|
|
23
|
+
return response;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-retrieve-run",
|
|
5
|
+
name: "Retrieve Run",
|
|
6
|
+
description: "Retrieves a specific run within a thread. [See the documentation](https://platform.openai.com/docs/api-reference)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
runId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"runId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
async run({ $ }) {
|
|
25
|
+
const response = await this.openai.retrieveRun({
|
|
26
|
+
threadId: this.threadId,
|
|
27
|
+
runId: this.runId,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
$.export("$summary", `Successfully retrieved run ${this.runId} in thread ${this.threadId}`);
|
|
31
|
+
return response;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-retrieve-run-step",
|
|
5
|
+
name: "Retrieve Run Step",
|
|
6
|
+
description: "Retrieve a specific run step in a thread. [See the documentation](https://platform.openai.com/docs/api-reference)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
runId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"runId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
stepId: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
openai,
|
|
26
|
+
"stepId",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const response = await this.openai.retrieveRunStep({
|
|
32
|
+
threadId: this.threadId,
|
|
33
|
+
runId: this.runId,
|
|
34
|
+
stepId: this.stepId,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
$.export("$summary", `Successfully retrieved run step with ID ${this.stepId}`);
|
|
38
|
+
return response;
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import openai from "../../
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
2
|
import common from "../common/common.mjs";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
...common,
|
|
6
6
|
name: "Create Completion (Send Prompt)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.2",
|
|
8
8
|
key: "openai-send-prompt",
|
|
9
9
|
description: "OpenAI recommends using the **Chat** action for the latest `gpt-3.5-turbo` API, since it's faster and 10x cheaper. This action creates a completion for the provided prompt and parameters using the older `/completions` API. [See docs here](https://beta.openai.com/docs/api-reference/completions/create)",
|
|
10
10
|
type: "action",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-submit-tool-outputs-to-run",
|
|
5
|
+
name: "Submit Tool Outputs to Run",
|
|
6
|
+
description: "Submits tool outputs to a run that requires action. [See the documentation](https://platform.openai.com/docs/api-reference)",
|
|
7
|
+
version: "0.0.1",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
threadId: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
openai,
|
|
14
|
+
"threadId",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
runId: {
|
|
18
|
+
propDefinition: [
|
|
19
|
+
openai,
|
|
20
|
+
"runId",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
toolOutputs: {
|
|
24
|
+
propDefinition: [
|
|
25
|
+
openai,
|
|
26
|
+
"toolOutputs",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
async run({ $ }) {
|
|
31
|
+
const parsedToolOutputs = this.toolOutputs.map(JSON.parse);
|
|
32
|
+
const response = await this.openai.submitToolOutputs({
|
|
33
|
+
threadId: this.threadId,
|
|
34
|
+
runId: this.runId,
|
|
35
|
+
toolOutputs: parsedToolOutputs,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
$.export("$summary", `Successfully submitted tool outputs to run ${this.runId}`);
|
|
39
|
+
return response;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
@@ -9,7 +9,7 @@ const langOptions = lang.LANGUAGES.map((l) => ({
|
|
|
9
9
|
export default {
|
|
10
10
|
...common,
|
|
11
11
|
name: "Translate Text",
|
|
12
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.7",
|
|
13
13
|
key: "openai-translate-text",
|
|
14
14
|
description: "Translate text from one language to another using the Chat API",
|
|
15
15
|
type: "action",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import openai from "../../openai.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "openai-upload-file",
|
|
5
|
+
name: "Upload File",
|
|
6
|
+
description: "Upload a file that can be used across various endpoints/features. The size of individual files can be a maximum of 512mb. [See the documentation](https://beta.openai.com/docs/guides/files)",
|
|
7
|
+
version: "0.0.4",
|
|
8
|
+
type: "action",
|
|
9
|
+
props: {
|
|
10
|
+
openai,
|
|
11
|
+
file: {
|
|
12
|
+
type: "string",
|
|
13
|
+
label: "File",
|
|
14
|
+
description: "The file content to be uploaded, represented as a string. The size of individual files can be a maximum of 512mb.",
|
|
15
|
+
},
|
|
16
|
+
purpose: {
|
|
17
|
+
type: "string",
|
|
18
|
+
label: "Purpose",
|
|
19
|
+
description: "The intended purpose of the file.",
|
|
20
|
+
options: [
|
|
21
|
+
{
|
|
22
|
+
label: "fine-tune",
|
|
23
|
+
value: "fine-tune",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: "assistants",
|
|
27
|
+
value: "assistants",
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
async run({ $ }) {
|
|
33
|
+
const response = await this.openai.uploadFile({
|
|
34
|
+
file: this.file,
|
|
35
|
+
purpose: this.purpose,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
$.export("$summary", `Successfully uploaded file with purpose: ${this.purpose}`);
|
|
39
|
+
return response;
|
|
40
|
+
},
|
|
41
|
+
};
|