@activepieces/piece-deepseek 0.1.4 → 0.1.5
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/package.json +7 -14
- package/src/index.js +59 -18
- package/src/index.d.ts +0 -2
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/ask-deepseek.d.ts +0 -13
- package/src/lib/actions/ask-deepseek.d.ts.map +0 -1
- package/src/lib/actions/ask-deepseek.js +0 -179
- package/src/lib/actions/ask-deepseek.js.map +0 -1
- package/src/lib/auth.d.ts +0 -2
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -42
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/common.d.ts +0 -3
- package/src/lib/common/common.d.ts.map +0 -1
- package/src/lib/common/common.js +0 -7
- package/src/lib/common/common.js.map +0 -1
package/src/index.d.ts
DELETED
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AASI,eAAO,MAAM,QAAQ,mHASnB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,qEAAwE;AAGxE,6DAAyD;AACzD,iDAAqD;AACrD,qCAA0C;AAGzB,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,mBAAY;IAClB,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,OAAO,EAAE,CAAC,0BAAW,CAAC;IACtB,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const askDeepseek: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
-
model: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
-
prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
|
-
frequencyPenalty: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
5
|
-
maxTokens: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
6
|
-
presencePenalty: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
-
responseFormat: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
-
temperature: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
-
topP: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
10
|
-
memoryKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
roles: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
12
|
-
}>;
|
|
13
|
-
//# sourceMappingURL=ask-deepseek.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-deepseek.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/ask-deepseek.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW;;;;;;;;;;;EA8LtB,CAAC"}
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.askDeepseek = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const auth_1 = require("../auth");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const openai_1 = tslib_1.__importDefault(require("openai"));
|
|
8
|
-
const common_1 = require("../common/common");
|
|
9
|
-
const zod_1 = require("zod");
|
|
10
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
11
|
-
exports.askDeepseek = (0, pieces_framework_1.createAction)({
|
|
12
|
-
audience: 'human',
|
|
13
|
-
auth: auth_1.deepseekAuth,
|
|
14
|
-
name: 'ask_deepseek',
|
|
15
|
-
displayName: 'Ask Deepseek',
|
|
16
|
-
description: 'Ask Deepseek anything you want!',
|
|
17
|
-
props: {
|
|
18
|
-
model: pieces_framework_1.Property.Dropdown({
|
|
19
|
-
auth: auth_1.deepseekAuth,
|
|
20
|
-
displayName: 'Model',
|
|
21
|
-
required: true,
|
|
22
|
-
description: 'The model which will generate the completion.',
|
|
23
|
-
refreshers: [],
|
|
24
|
-
defaultValue: 'deepseek-chat',
|
|
25
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
26
|
-
if (!auth) {
|
|
27
|
-
return {
|
|
28
|
-
disabled: true,
|
|
29
|
-
placeholder: 'Enter your API key first',
|
|
30
|
-
options: [],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const openai = new openai_1.default({
|
|
35
|
-
baseURL: common_1.baseUrl,
|
|
36
|
-
apiKey: auth.secret_text,
|
|
37
|
-
});
|
|
38
|
-
const response = yield openai.models.list();
|
|
39
|
-
// We need to get only LLM models
|
|
40
|
-
const models = response.data;
|
|
41
|
-
return {
|
|
42
|
-
disabled: false,
|
|
43
|
-
options: models.map((model) => {
|
|
44
|
-
return {
|
|
45
|
-
label: model.id,
|
|
46
|
-
value: model.id,
|
|
47
|
-
};
|
|
48
|
-
}),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
return {
|
|
53
|
-
disabled: true,
|
|
54
|
-
options: [],
|
|
55
|
-
placeholder: "Couldn't load models, API key is invalid",
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}),
|
|
59
|
-
}),
|
|
60
|
-
prompt: pieces_framework_1.Property.LongText({
|
|
61
|
-
displayName: 'Question',
|
|
62
|
-
required: true,
|
|
63
|
-
}),
|
|
64
|
-
frequencyPenalty: pieces_framework_1.Property.Number({
|
|
65
|
-
displayName: 'Frequency penalty',
|
|
66
|
-
required: false,
|
|
67
|
-
description: "Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.",
|
|
68
|
-
defaultValue: 0,
|
|
69
|
-
}),
|
|
70
|
-
maxTokens: pieces_framework_1.Property.Number({
|
|
71
|
-
displayName: 'Maximum Tokens',
|
|
72
|
-
required: true,
|
|
73
|
-
description: 'The maximum number of tokens to generate. Possible values are between 1 and 8192.',
|
|
74
|
-
defaultValue: 4096,
|
|
75
|
-
}),
|
|
76
|
-
presencePenalty: pieces_framework_1.Property.Number({
|
|
77
|
-
displayName: 'Presence penalty',
|
|
78
|
-
required: false,
|
|
79
|
-
description: "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the mode's likelihood to talk about new topics.",
|
|
80
|
-
defaultValue: 0,
|
|
81
|
-
}),
|
|
82
|
-
responseFormat: pieces_framework_1.Property.StaticDropdown({
|
|
83
|
-
displayName: 'Response Format',
|
|
84
|
-
description: 'The format of the response. IMPORTANT: When using JSON Output, you must also instruct the model to produce JSON yourself',
|
|
85
|
-
required: true,
|
|
86
|
-
defaultValue: 'text',
|
|
87
|
-
options: {
|
|
88
|
-
options: [
|
|
89
|
-
{
|
|
90
|
-
label: 'Text',
|
|
91
|
-
value: 'text',
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
label: 'JSON',
|
|
95
|
-
value: 'json_object',
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
}),
|
|
100
|
-
temperature: pieces_framework_1.Property.Number({
|
|
101
|
-
displayName: 'Temperature',
|
|
102
|
-
required: false,
|
|
103
|
-
description: 'Controls randomness: Lowering results in less random completions. As the temperature approaches zero, the model will become deterministic and repetitive. Between 0 and 2. We generally recommend altering this or top_p but not both.',
|
|
104
|
-
defaultValue: 1,
|
|
105
|
-
}),
|
|
106
|
-
topP: pieces_framework_1.Property.Number({
|
|
107
|
-
displayName: 'Top P',
|
|
108
|
-
required: false,
|
|
109
|
-
description: 'An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. Values <=1. We generally recommend altering this or temperature but not both.',
|
|
110
|
-
defaultValue: 1,
|
|
111
|
-
}),
|
|
112
|
-
memoryKey: pieces_framework_1.Property.ShortText({
|
|
113
|
-
displayName: 'Memory Key',
|
|
114
|
-
description: 'A memory key that will keep the chat history shared across runs and flows. Keep it empty to leave Deepseek without memory of previous messages.',
|
|
115
|
-
required: false,
|
|
116
|
-
}),
|
|
117
|
-
roles: pieces_framework_1.Property.Json({
|
|
118
|
-
displayName: 'Roles',
|
|
119
|
-
required: false,
|
|
120
|
-
description: 'Array of roles to specify more accurate response',
|
|
121
|
-
defaultValue: [
|
|
122
|
-
{ role: 'system', content: 'You are a helpful assistant.' },
|
|
123
|
-
],
|
|
124
|
-
}),
|
|
125
|
-
},
|
|
126
|
-
run(_a) {
|
|
127
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue, store }) {
|
|
128
|
-
var _b;
|
|
129
|
-
yield pieces_common_1.propsValidation.validateZod(propsValue, {
|
|
130
|
-
temperature: zod_1.z.number().min(0).max(2).optional(),
|
|
131
|
-
memoryKey: zod_1.z.string().max(128).optional(),
|
|
132
|
-
});
|
|
133
|
-
const openai = new openai_1.default({
|
|
134
|
-
baseURL: common_1.baseUrl,
|
|
135
|
-
apiKey: auth.secret_text,
|
|
136
|
-
});
|
|
137
|
-
const { model, temperature, maxTokens, topP, frequencyPenalty, presencePenalty, responseFormat, prompt, memoryKey, } = propsValue;
|
|
138
|
-
let messageHistory = [];
|
|
139
|
-
// If memory key is set, retrieve messages stored in history
|
|
140
|
-
if (memoryKey) {
|
|
141
|
-
messageHistory = (_b = (yield store.get(memoryKey, pieces_framework_1.StoreScope.PROJECT))) !== null && _b !== void 0 ? _b : [];
|
|
142
|
-
}
|
|
143
|
-
// Add user prompt to message history
|
|
144
|
-
messageHistory.push({
|
|
145
|
-
role: 'user',
|
|
146
|
-
content: prompt,
|
|
147
|
-
});
|
|
148
|
-
// Add system instructions if set by user
|
|
149
|
-
const rolesArray = propsValue.roles ? propsValue.roles : [];
|
|
150
|
-
const roles = rolesArray.map((item) => {
|
|
151
|
-
const rolesEnum = ['system', 'user', 'assistant'];
|
|
152
|
-
if (!rolesEnum.includes(item.role)) {
|
|
153
|
-
throw new Error('The only available roles are: [system, user, assistant]');
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
role: item.role,
|
|
157
|
-
content: item.content,
|
|
158
|
-
};
|
|
159
|
-
});
|
|
160
|
-
// Send prompt
|
|
161
|
-
const completion = yield openai.chat.completions.create({
|
|
162
|
-
model: model,
|
|
163
|
-
messages: [...roles, ...messageHistory],
|
|
164
|
-
temperature: temperature,
|
|
165
|
-
max_tokens: maxTokens,
|
|
166
|
-
top_p: topP,
|
|
167
|
-
frequency_penalty: frequencyPenalty,
|
|
168
|
-
presence_penalty: presencePenalty,
|
|
169
|
-
response_format: responseFormat === "json_object" ? { "type": "json_object" } : { "type": "text" },
|
|
170
|
-
});
|
|
171
|
-
messageHistory = [...messageHistory, completion.choices[0].message];
|
|
172
|
-
if (memoryKey) {
|
|
173
|
-
yield store.put(memoryKey, messageHistory, pieces_framework_1.StoreScope.PROJECT);
|
|
174
|
-
}
|
|
175
|
-
return completion.choices[0].message.content;
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
//# sourceMappingURL=ask-deepseek.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-deepseek.js","sourceRoot":"","sources":["../../../../src/lib/actions/ask-deepseek.ts"],"names":[],"mappings":";;;;AAAA,kCAAuC;AACvC,qEAAoF;AACpF,4DAA4B;AAC5B,6CAA2C;AAC3C,6BA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AC;YAEpE,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,6BAAU,CAAC,OAAO,CAAC,CAAC;YACjE,CAAC;YAED,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts
DELETED
package/src/lib/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,mEAiCnB,CAAC"}
|
package/src/lib/auth.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deepseekAuth = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const openai_1 = tslib_1.__importDefault(require("openai"));
|
|
7
|
-
const common_1 = require("./common/common");
|
|
8
|
-
exports.deepseekAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
-
description: `
|
|
10
|
-
Follow these instructions to get your DeepSeek API Key:
|
|
11
|
-
|
|
12
|
-
1. Visit the following website: https://platform.deepseek.com/api_keys.
|
|
13
|
-
2. Once on the website, locate and click on the option to obtain your DeepSeek API Key.`,
|
|
14
|
-
displayName: 'API Key',
|
|
15
|
-
required: true,
|
|
16
|
-
validate: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
try {
|
|
18
|
-
const openai = new openai_1.default({
|
|
19
|
-
baseURL: common_1.baseUrl,
|
|
20
|
-
apiKey: auth.auth,
|
|
21
|
-
});
|
|
22
|
-
const models = yield openai.models.list();
|
|
23
|
-
if (models.data.length > 0) {
|
|
24
|
-
return {
|
|
25
|
-
valid: true,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
else
|
|
29
|
-
return {
|
|
30
|
-
valid: false,
|
|
31
|
-
error: common_1.unauthorizedMessage,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
return {
|
|
36
|
-
valid: false,
|
|
37
|
-
error: common_1.unauthorizedMessage,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
}),
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=auth.js.map
|
package/src/lib/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,4DAA4B;AAC5B,4CAA+D;AAElD,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAC;;;;wFAIsE;IAClF,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,CAAO,IAAI,EAAE,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC;gBACxB,OAAO,EAAE,gBAAO;gBAChB,MAAM,EAAE,IAAI,CAAC,IAAI;aAClB,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1C,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAC,CAAC;gBAC1B,OAAO;oBACL,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;;gBAED,OAAO;oBACL,KAAK,EAAE,KAAK;oBACZ,KAAK,EAAE,4BAAmB;iBAC3B,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,4BAAmB;aAC3B,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/common.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,6BAA6B,CAAC;AAElD,eAAO,MAAM,mBAAmB,kEACM,CAAC"}
|
package/src/lib/common/common.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unauthorizedMessage = exports.baseUrl = void 0;
|
|
4
|
-
exports.baseUrl = 'https://api.deepseek.com';
|
|
5
|
-
exports.unauthorizedMessage = `Error Occurred: 401 \n
|
|
6
|
-
Ensure that your API key is valid. \n`;
|
|
7
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/lib/common/common.ts"],"names":[],"mappings":";;;AACa,QAAA,OAAO,GAAG,0BAA0B,CAAC;AAErC,QAAA,mBAAmB,GAAG;sCACG,CAAC"}
|