@pipedream/openai 0.0.2 → 0.1.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/actions/chat/chat.mjs +56 -0
- package/actions/classify-items-into-categories/classify-items-into-categories.mjs +56 -0
- package/actions/common/common-helper.mjs +55 -0
- package/actions/common/common.mjs +141 -0
- package/actions/common/constants.mjs +6 -3
- package/actions/common/lang.mjs +736 -0
- package/actions/create-embeddings/create-embeddings.mjs +51 -0
- package/actions/create-image/create-image.mjs +6 -13
- package/actions/create-transcription/create-transcription.mjs +133 -0
- package/actions/send-prompt/send-prompt.mjs +14 -75
- package/actions/summarize/summarize.mjs +55 -0
- package/actions/translate-text/translate-text.mjs +62 -0
- package/app/openai.app.mjs +179 -0
- package/package.json +8 -3
- package/openai.app.mjs +0 -57
package/openai.app.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { axios } from "@pipedream/platform";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
type: "app",
|
|
5
|
-
app: "openai",
|
|
6
|
-
propDefinitions: {
|
|
7
|
-
modelId: {
|
|
8
|
-
label: "Model ID",
|
|
9
|
-
description: "ID of the model to use",
|
|
10
|
-
type: "string",
|
|
11
|
-
async options() {
|
|
12
|
-
const { data: models } = await this.getModels();
|
|
13
|
-
|
|
14
|
-
return models.map((model) => model.id);
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
methods: {
|
|
19
|
-
_apiKey() {
|
|
20
|
-
return this.$auth.api_key;
|
|
21
|
-
},
|
|
22
|
-
_apiUrl() {
|
|
23
|
-
return "https://api.openai.com/v1";
|
|
24
|
-
},
|
|
25
|
-
async _makeRequest({
|
|
26
|
-
$ = this, path, ...args
|
|
27
|
-
}) {
|
|
28
|
-
return axios($, {
|
|
29
|
-
url: `${this._apiUrl()}${path}`,
|
|
30
|
-
headers: {
|
|
31
|
-
Authorization: `Bearer ${this._apiKey()}`,
|
|
32
|
-
},
|
|
33
|
-
...args,
|
|
34
|
-
});
|
|
35
|
-
},
|
|
36
|
-
async getModels(args = {}) {
|
|
37
|
-
return this._makeRequest({
|
|
38
|
-
path: "/models",
|
|
39
|
-
...args,
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
async sendPrompt(args = {}) {
|
|
43
|
-
return this._makeRequest({
|
|
44
|
-
path: "/completions",
|
|
45
|
-
method: "post",
|
|
46
|
-
...args,
|
|
47
|
-
});
|
|
48
|
-
},
|
|
49
|
-
async createImage(args = {}) {
|
|
50
|
-
return this._makeRequest({
|
|
51
|
-
path: "/images/generations",
|
|
52
|
-
method: "post",
|
|
53
|
-
...args,
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
};
|