@activepieces/piece-amazon-bedrock 0.1.2 → 0.2.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/package.json +7 -17
- package/src/i18n/translation.json +0 -26
- package/src/index.js +109 -23
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/actions/custom-api-call.d.ts +0 -16
- package/src/lib/actions/custom-api-call.d.ts.map +0 -1
- package/src/lib/actions/custom-api-call.js +0 -174
- package/src/lib/actions/custom-api-call.js.map +0 -1
- package/src/lib/actions/generate-content-from-image.d.ts +0 -22
- package/src/lib/actions/generate-content-from-image.d.ts.map +0 -1
- package/src/lib/actions/generate-content-from-image.js +0 -126
- package/src/lib/actions/generate-content-from-image.js.map +0 -1
- package/src/lib/actions/generate-embeddings.d.ts +0 -16
- package/src/lib/actions/generate-embeddings.d.ts.map +0 -1
- package/src/lib/actions/generate-embeddings.js +0 -153
- package/src/lib/actions/generate-embeddings.js.map +0 -1
- package/src/lib/actions/generate-image.d.ts +0 -17
- package/src/lib/actions/generate-image.d.ts.map +0 -1
- package/src/lib/actions/generate-image.js +0 -140
- package/src/lib/actions/generate-image.js.map +0 -1
- package/src/lib/actions/send-prompt.d.ts +0 -25
- package/src/lib/actions/send-prompt.d.ts.map +0 -1
- package/src/lib/actions/send-prompt.js +0 -160
- package/src/lib/actions/send-prompt.js.map +0 -1
- package/src/lib/auth.d.ts +0 -6
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -109
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common.d.ts +0 -37
- package/src/lib/common.d.ts.map +0 -1
- package/src/lib/common.js +0 -239
- package/src/lib/common.js.map +0 -1
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateImage = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const client_bedrock_runtime_1 = require("@aws-sdk/client-bedrock-runtime");
|
|
7
|
-
const client_bedrock_1 = require("@aws-sdk/client-bedrock");
|
|
8
|
-
const auth_1 = require("../auth");
|
|
9
|
-
const common_1 = require("../common");
|
|
10
|
-
exports.generateImage = (0, pieces_framework_1.createAction)({
|
|
11
|
-
audience: 'human',
|
|
12
|
-
auth: auth_1.awsBedrockAuth,
|
|
13
|
-
name: 'generate_image',
|
|
14
|
-
displayName: 'Generate Image',
|
|
15
|
-
description: 'Generate an image from a text prompt using Amazon Titan Image Generator or Stability AI models.',
|
|
16
|
-
props: {
|
|
17
|
-
model: pieces_framework_1.Property.Dropdown({
|
|
18
|
-
displayName: 'Model',
|
|
19
|
-
required: true,
|
|
20
|
-
auth: auth_1.awsBedrockAuth,
|
|
21
|
-
description: 'The image generation model to use.',
|
|
22
|
-
refreshers: [],
|
|
23
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
24
|
-
if (!auth) {
|
|
25
|
-
return {
|
|
26
|
-
disabled: true,
|
|
27
|
-
placeholder: 'Connect your AWS account first',
|
|
28
|
-
options: [],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return (0, common_1.getBedrockModelOptions)(auth.props, {
|
|
32
|
-
outputModality: client_bedrock_1.ModelModality.IMAGE,
|
|
33
|
-
});
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
prompt: pieces_framework_1.Property.LongText({
|
|
37
|
-
displayName: 'Prompt',
|
|
38
|
-
required: true,
|
|
39
|
-
description: 'A text description of the image you want to generate.',
|
|
40
|
-
}),
|
|
41
|
-
negativePrompt: pieces_framework_1.Property.LongText({
|
|
42
|
-
displayName: 'Negative Prompt',
|
|
43
|
-
required: false,
|
|
44
|
-
description: 'Describe what you do NOT want in the image. Helps refine the output.',
|
|
45
|
-
}),
|
|
46
|
-
width: pieces_framework_1.Property.Number({
|
|
47
|
-
displayName: 'Width',
|
|
48
|
-
required: false,
|
|
49
|
-
description: 'Image width in pixels. Must be supported by the model.',
|
|
50
|
-
defaultValue: 1024,
|
|
51
|
-
}),
|
|
52
|
-
height: pieces_framework_1.Property.Number({
|
|
53
|
-
displayName: 'Height',
|
|
54
|
-
required: false,
|
|
55
|
-
description: 'Image height in pixels. Must be supported by the model.',
|
|
56
|
-
defaultValue: 1024,
|
|
57
|
-
}),
|
|
58
|
-
seed: pieces_framework_1.Property.Number({
|
|
59
|
-
displayName: 'Seed',
|
|
60
|
-
required: false,
|
|
61
|
-
description: 'A seed for reproducible results. Use the same seed and prompt to get the same image.',
|
|
62
|
-
}),
|
|
63
|
-
},
|
|
64
|
-
run(_a) {
|
|
65
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue, files }) {
|
|
66
|
-
const client = (0, common_1.createBedrockRuntimeClient)(auth.props);
|
|
67
|
-
const { model, prompt, negativePrompt, width, height, seed } = propsValue;
|
|
68
|
-
const isTitan = model.startsWith('amazon.titan-image');
|
|
69
|
-
const isStability = model.startsWith('stability.');
|
|
70
|
-
const isNovaCanvas = model.startsWith('amazon.nova-canvas');
|
|
71
|
-
let requestBody;
|
|
72
|
-
if (isTitan) {
|
|
73
|
-
requestBody = {
|
|
74
|
-
taskType: 'TEXT_IMAGE',
|
|
75
|
-
textToImageParams: Object.assign({ text: prompt }, (negativePrompt ? { negativeText: negativePrompt } : {})),
|
|
76
|
-
imageGenerationConfig: Object.assign({ numberOfImages: 1, width: width !== null && width !== void 0 ? width : 1024, height: height !== null && height !== void 0 ? height : 1024 }, (seed != null ? { seed: seed } : {})),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
else if (isNovaCanvas) {
|
|
80
|
-
requestBody = {
|
|
81
|
-
taskType: 'TEXT_IMAGE',
|
|
82
|
-
textToImageParams: Object.assign({ text: prompt }, (negativePrompt ? { negativeText: negativePrompt } : {})),
|
|
83
|
-
imageGenerationConfig: Object.assign({ numberOfImages: 1, width: width !== null && width !== void 0 ? width : 1024, height: height !== null && height !== void 0 ? height : 1024 }, (seed != null ? { seed: seed } : {})),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
else if (isStability) {
|
|
87
|
-
requestBody = Object.assign({ text_prompts: [
|
|
88
|
-
{ text: prompt, weight: 1 },
|
|
89
|
-
...(negativePrompt
|
|
90
|
-
? [{ text: negativePrompt, weight: -1 }]
|
|
91
|
-
: []),
|
|
92
|
-
], cfg_scale: 7, steps: 30, width: width !== null && width !== void 0 ? width : 1024, height: height !== null && height !== void 0 ? height : 1024 }, (seed != null ? { seed: seed } : {}));
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
requestBody = Object.assign({ text_prompts: [
|
|
96
|
-
{ text: prompt, weight: 1 },
|
|
97
|
-
...(negativePrompt
|
|
98
|
-
? [{ text: negativePrompt, weight: -1 }]
|
|
99
|
-
: []),
|
|
100
|
-
], width: width !== null && width !== void 0 ? width : 1024, height: height !== null && height !== void 0 ? height : 1024 }, (seed != null ? { seed: seed } : {}));
|
|
101
|
-
}
|
|
102
|
-
try {
|
|
103
|
-
const response = yield client.send(new client_bedrock_runtime_1.InvokeModelCommand({
|
|
104
|
-
modelId: model,
|
|
105
|
-
body: Buffer.from(JSON.stringify(requestBody)),
|
|
106
|
-
contentType: 'application/json',
|
|
107
|
-
accept: 'application/json',
|
|
108
|
-
}));
|
|
109
|
-
const responseBody = JSON.parse(new TextDecoder().decode(response.body));
|
|
110
|
-
let base64Image;
|
|
111
|
-
if (responseBody.images && responseBody.images.length > 0) {
|
|
112
|
-
base64Image = responseBody.images[0];
|
|
113
|
-
}
|
|
114
|
-
else if (responseBody.artifacts &&
|
|
115
|
-
responseBody.artifacts.length > 0) {
|
|
116
|
-
base64Image = responseBody.artifacts[0].base64;
|
|
117
|
-
}
|
|
118
|
-
if (!base64Image) {
|
|
119
|
-
throw new Error('No image was returned by the model. The response format may not be supported.');
|
|
120
|
-
}
|
|
121
|
-
const imageBuffer = Buffer.from(base64Image, 'base64');
|
|
122
|
-
const file = yield files.write({
|
|
123
|
-
fileName: 'generated-image.png',
|
|
124
|
-
data: imageBuffer,
|
|
125
|
-
});
|
|
126
|
-
return {
|
|
127
|
-
image: file,
|
|
128
|
-
model: model,
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
catch (error) {
|
|
132
|
-
if (error instanceof Error && error.message.includes('No image')) {
|
|
133
|
-
throw error;
|
|
134
|
-
}
|
|
135
|
-
throw new Error((0, common_1.formatBedrockError)(error));
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
//# sourceMappingURL=generate-image.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-image.js","sourceRoot":"","sources":["../../../../src/lib/actions/generate-image.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4EAAqE;AACrE,4DAAwD;AACxD,kCAAyC;AACzC,sCAImB;AAEN,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,iGAAiG;IACnG,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,qBAAc;YACpB,WAAW,EAAE,oCAAoC;YACjD,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,gCAAgC;wBAC7C,OAAO,EAAE,EAAE;qBACZ,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAA,+BA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
-
export declare const sendPrompt: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
|
-
}>, {
|
|
6
|
-
model: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
10
|
-
}>>;
|
|
11
|
-
prompt: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
12
|
-
systemPrompt: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
13
|
-
temperature: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
14
|
-
maxTokens: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
15
|
-
topP: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
16
|
-
stopSequences: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
17
|
-
memoryKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
-
attachmentSource: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
19
|
-
attachment: import("@activepieces/pieces-framework").DynamicProperties<false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
20
|
-
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
21
|
-
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
22
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
23
|
-
}>>;
|
|
24
|
-
}>;
|
|
25
|
-
//# sourceMappingURL=send-prompt.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-prompt.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/send-prompt.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;EA+KrB,CAAC"}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendPrompt = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const client_bedrock_runtime_1 = require("@aws-sdk/client-bedrock-runtime");
|
|
7
|
-
const auth_1 = require("../auth");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.sendPrompt = (0, pieces_framework_1.createAction)({
|
|
10
|
-
audience: 'human',
|
|
11
|
-
auth: auth_1.awsBedrockAuth,
|
|
12
|
-
name: 'send_prompt',
|
|
13
|
-
displayName: 'Ask Bedrock',
|
|
14
|
-
description: 'Send a text prompt to an Amazon Bedrock model.',
|
|
15
|
-
props: {
|
|
16
|
-
model: pieces_framework_1.Property.Dropdown({
|
|
17
|
-
displayName: 'Model',
|
|
18
|
-
required: true,
|
|
19
|
-
auth: auth_1.awsBedrockAuth,
|
|
20
|
-
description: 'The foundation model to use for generation.',
|
|
21
|
-
refreshers: [],
|
|
22
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
23
|
-
if (!auth) {
|
|
24
|
-
return {
|
|
25
|
-
disabled: true,
|
|
26
|
-
placeholder: 'Connect your AWS account first',
|
|
27
|
-
options: [],
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
return (0, common_1.getBedrockModelOptions)(auth.props, { useInferenceProfiles: true });
|
|
31
|
-
}),
|
|
32
|
-
}),
|
|
33
|
-
prompt: pieces_framework_1.Property.LongText({
|
|
34
|
-
displayName: 'Prompt',
|
|
35
|
-
description: 'The message or question to send to the model.',
|
|
36
|
-
required: true,
|
|
37
|
-
}),
|
|
38
|
-
systemPrompt: pieces_framework_1.Property.LongText({
|
|
39
|
-
displayName: 'System Prompt',
|
|
40
|
-
required: false,
|
|
41
|
-
description: 'Instructions that set the model\'s behavior and persona (e.g. "You are a helpful assistant that replies concisely.").',
|
|
42
|
-
}),
|
|
43
|
-
temperature: pieces_framework_1.Property.Number({
|
|
44
|
-
displayName: 'Temperature',
|
|
45
|
-
required: false,
|
|
46
|
-
description: 'Controls how creative or predictable the response is. Lower values (e.g. 0.2) give focused, consistent answers. Higher values (e.g. 0.9) give more varied, creative output.',
|
|
47
|
-
defaultValue: 0.7,
|
|
48
|
-
}),
|
|
49
|
-
maxTokens: pieces_framework_1.Property.Number({
|
|
50
|
-
displayName: 'Maximum Tokens',
|
|
51
|
-
required: false,
|
|
52
|
-
description: 'The maximum length of the response. One token is roughly 4 characters. 2048 tokens ≈ ~1500 words.',
|
|
53
|
-
defaultValue: 2048,
|
|
54
|
-
}),
|
|
55
|
-
topP: pieces_framework_1.Property.Number({
|
|
56
|
-
displayName: 'Top P',
|
|
57
|
-
required: false,
|
|
58
|
-
description: 'Limits the pool of words the model picks from (0–1). Lower values make responses more focused. Leave at 1 to disable this filter and use Temperature instead.',
|
|
59
|
-
defaultValue: 1,
|
|
60
|
-
}),
|
|
61
|
-
stopSequences: pieces_framework_1.Property.Array({
|
|
62
|
-
displayName: 'Stop Sequences',
|
|
63
|
-
required: false,
|
|
64
|
-
description: 'Text strings that, when generated, cause the model to stop immediately (e.g. "END" or "\\n\\n"). Up to 4 sequences.',
|
|
65
|
-
}),
|
|
66
|
-
memoryKey: pieces_framework_1.Property.ShortText({
|
|
67
|
-
displayName: 'Conversation Memory ID',
|
|
68
|
-
required: false,
|
|
69
|
-
description: 'A unique name for this conversation\'s memory (e.g. "support-chat-user-123"). When set, the model remembers previous messages in this flow. Leave empty for a single-turn interaction with no memory.',
|
|
70
|
-
}),
|
|
71
|
-
attachmentSource: pieces_framework_1.Property.StaticDropdown({
|
|
72
|
-
displayName: 'Attachment Source (Optional)',
|
|
73
|
-
description: 'Optionally include a file alongside your prompt. Choose whether to upload directly or reference one from S3.',
|
|
74
|
-
required: false,
|
|
75
|
-
options: {
|
|
76
|
-
options: [
|
|
77
|
-
{ label: 'Upload a file', value: 'file' },
|
|
78
|
-
{ label: 'From S3 bucket', value: 's3' },
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
}),
|
|
82
|
-
attachment: pieces_framework_1.Property.DynamicProperties({
|
|
83
|
-
auth: auth_1.awsBedrockAuth,
|
|
84
|
-
displayName: 'Attachment',
|
|
85
|
-
required: false,
|
|
86
|
-
refreshers: ['attachmentSource'],
|
|
87
|
-
props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ attachmentSource }) {
|
|
88
|
-
if (attachmentSource === 'file') {
|
|
89
|
-
return {
|
|
90
|
-
file: pieces_framework_1.Property.File({
|
|
91
|
-
displayName: 'File',
|
|
92
|
-
description: 'Supported: images (png, jpg, gif, webp), documents (pdf, csv, doc, docx, xls, xlsx, html, txt, md), videos (mp4, mov, mkv, etc.), audio (mp3, wav, aac, flac, etc.). Not all models support all file types.',
|
|
93
|
-
required: true,
|
|
94
|
-
}),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
if (attachmentSource === 's3') {
|
|
98
|
-
return {
|
|
99
|
-
s3Bucket: pieces_framework_1.Property.ShortText({
|
|
100
|
-
displayName: 'S3 Bucket',
|
|
101
|
-
description: 'The name of your S3 bucket containing the file.',
|
|
102
|
-
required: true,
|
|
103
|
-
}),
|
|
104
|
-
s3Key: pieces_framework_1.Property.ShortText({
|
|
105
|
-
displayName: 'S3 File Path',
|
|
106
|
-
description: 'The path to the file in your S3 bucket (e.g. "documents/report.pdf"). The file extension determines the media type sent to the model.',
|
|
107
|
-
required: true,
|
|
108
|
-
}),
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
return {};
|
|
112
|
-
}),
|
|
113
|
-
}),
|
|
114
|
-
},
|
|
115
|
-
run(_a) {
|
|
116
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue, store }) {
|
|
117
|
-
var _b, _c;
|
|
118
|
-
const client = (0, common_1.createBedrockRuntimeClient)(auth.props);
|
|
119
|
-
const { model, prompt, systemPrompt, temperature, maxTokens, topP, stopSequences, memoryKey, attachmentSource, attachment, } = propsValue;
|
|
120
|
-
let messageHistory = [];
|
|
121
|
-
if (memoryKey) {
|
|
122
|
-
messageHistory =
|
|
123
|
-
(_b = (yield store.get(memoryKey, pieces_framework_1.StoreScope.PROJECT))) !== null && _b !== void 0 ? _b : [];
|
|
124
|
-
}
|
|
125
|
-
const userContent = [{ text: prompt }];
|
|
126
|
-
if (attachmentSource === 'file' && (attachment === null || attachment === void 0 ? void 0 : attachment['file'])) {
|
|
127
|
-
userContent.push((0, common_1.buildFileContentBlock)(attachment['file']));
|
|
128
|
-
}
|
|
129
|
-
else if (attachmentSource === 's3' && (attachment === null || attachment === void 0 ? void 0 : attachment['s3Bucket']) && (attachment === null || attachment === void 0 ? void 0 : attachment['s3Key'])) {
|
|
130
|
-
userContent.push((0, common_1.buildS3ContentBlock)(attachment['s3Bucket'], attachment['s3Key']));
|
|
131
|
-
}
|
|
132
|
-
messageHistory.push({
|
|
133
|
-
role: client_bedrock_runtime_1.ConversationRole.USER,
|
|
134
|
-
content: userContent,
|
|
135
|
-
});
|
|
136
|
-
try {
|
|
137
|
-
const response = yield client.send(new client_bedrock_runtime_1.ConverseCommand(Object.assign(Object.assign({ modelId: model, messages: messageHistory }, (systemPrompt ? { system: [{ text: systemPrompt }] } : {})), { inferenceConfig: {
|
|
138
|
-
temperature: temperature !== null && temperature !== void 0 ? temperature : undefined,
|
|
139
|
-
maxTokens: maxTokens !== null && maxTokens !== void 0 ? maxTokens : undefined,
|
|
140
|
-
topP: topP !== null && topP !== void 0 ? topP : undefined,
|
|
141
|
-
stopSequences: stopSequences && stopSequences.length > 0
|
|
142
|
-
? stopSequences
|
|
143
|
-
: undefined,
|
|
144
|
-
} })));
|
|
145
|
-
const outputMessage = (_c = response.output) === null || _c === void 0 ? void 0 : _c.message;
|
|
146
|
-
if (outputMessage) {
|
|
147
|
-
messageHistory.push(outputMessage);
|
|
148
|
-
}
|
|
149
|
-
if (memoryKey) {
|
|
150
|
-
yield store.put(memoryKey, messageHistory, pieces_framework_1.StoreScope.PROJECT);
|
|
151
|
-
}
|
|
152
|
-
return (0, common_1.extractConverseTextResponse)(response);
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
throw new Error((0, common_1.formatBedrockError)(error));
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
//# sourceMappingURL=send-prompt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-prompt.js","sourceRoot":"","sources":["../../../../src/lib/actions/send-prompt.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,4EAKyC;AACzC,kCAAyC;AACzC,sCAOmB;AAEN,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,qBAAc;IACpB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,gDAAgD;IAC7D,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,qBAAc;YACpB,WAAW,EAAE,6CAA6C;YAC1D,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,QAAQ,EAAE,IAAI;wBACd,WAAW,EAAE,gCAAgC;wBAC7C,OAAO,EAAE,E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AE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAC7D,eAAe,EAAE;wBACf,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,SAAS;wBACrC,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,SAAS;wBACjC,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,SAAS;wBACvB,aAAa,EACX,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC;4BACvC,CAAC,CAAE,aAA0B;4BAC7B,CAAC,CAAC,SAAS;qBAChB,IACD,CACH,CAAC;gBAEF,MAAM,aAAa,GAAG,MAAA,QAAQ,CAAC,MAAM,0CAAE,OAAO,CAAC;gBAC/C,IAAI,aAAa,EAAE,CAAC;oBAClB,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBACrC,CAAC;gBAED,IAAI,SAAS,EAAE,CAAC;oBACd,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,6BAAU,CAAC,OAAO,CAAC,CAAC;gBACjE,CAAC;gBAED,OAAO,IAAA,oCAA2B,EAAC,QAAQ,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,IAAA,2BAAkB,EAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
package/src/lib/auth.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const awsBedrockAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
accessKeyId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
secretAccessKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
5
|
-
}>;
|
|
6
|
-
//# sourceMappingURL=auth.d.ts.map
|
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,cAAc;;;;EAmGzB,CAAC"}
|
package/src/lib/auth.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.awsBedrockAuth = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("./common");
|
|
7
|
-
const client_bedrock_1 = require("@aws-sdk/client-bedrock");
|
|
8
|
-
exports.awsBedrockAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
9
|
-
description: `Connect your AWS account to use Amazon Bedrock AI models.
|
|
10
|
-
|
|
11
|
-
**How to get your credentials:**
|
|
12
|
-
1. Open the [AWS IAM Console](https://console.aws.amazon.com/iam/) and go to **Users**.
|
|
13
|
-
2. Select your user (or create a new one), then go to **Security credentials**.
|
|
14
|
-
3. Click **Create access key** — copy both the Access Key ID and Secret Access Key.
|
|
15
|
-
4. Make sure the IAM user has the **AmazonBedrockFullAccess** policy attached.
|
|
16
|
-
|
|
17
|
-
**Enable model access:** In the [AWS Bedrock Console](https://console.aws.amazon.com/bedrock/), go to **Model access** and request access to the models you want to use.`,
|
|
18
|
-
props: {
|
|
19
|
-
accessKeyId: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'Access Key ID',
|
|
21
|
-
description: 'Your AWS access key ID. Found in AWS IAM Console → Users → Security credentials.',
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
|
-
secretAccessKey: pieces_framework_1.PieceAuth.SecretText({
|
|
25
|
-
displayName: 'Secret Access Key',
|
|
26
|
-
description: 'Your AWS secret access key. Only shown once when you create the access key — store it safely.',
|
|
27
|
-
required: true,
|
|
28
|
-
}),
|
|
29
|
-
region: pieces_framework_1.Property.StaticDropdown({
|
|
30
|
-
displayName: 'Region',
|
|
31
|
-
required: true,
|
|
32
|
-
options: {
|
|
33
|
-
options: [
|
|
34
|
-
{ label: 'US East (N. Virginia) [us-east-1]', value: 'us-east-1' },
|
|
35
|
-
{ label: 'US East (Ohio) [us-east-2]', value: 'us-east-2' },
|
|
36
|
-
{ label: 'US West (Oregon) [us-west-2]', value: 'us-west-2' },
|
|
37
|
-
{
|
|
38
|
-
label: 'Asia Pacific (Hyderabad) [ap-south-2]',
|
|
39
|
-
value: 'ap-south-2',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: 'Asia Pacific (Mumbai) [ap-south-1]',
|
|
43
|
-
value: 'ap-south-1',
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
label: 'Asia Pacific (Osaka) [ap-northeast-3]',
|
|
47
|
-
value: 'ap-northeast-3',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
label: 'Asia Pacific (Seoul) [ap-northeast-2]',
|
|
51
|
-
value: 'ap-northeast-2',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
label: 'Asia Pacific (Singapore) [ap-southeast-1]',
|
|
55
|
-
value: 'ap-southeast-1',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: 'Asia Pacific (Sydney) [ap-southeast-2]',
|
|
59
|
-
value: 'ap-southeast-2',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
label: 'Asia Pacific (Tokyo) [ap-northeast-1]',
|
|
63
|
-
value: 'ap-northeast-1',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: 'Canada (Central) [ca-central-1]',
|
|
67
|
-
value: 'ca-central-1',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: 'Europe (Frankfurt) [eu-central-1]',
|
|
71
|
-
value: 'eu-central-1',
|
|
72
|
-
},
|
|
73
|
-
{ label: 'Europe (Ireland) [eu-west-1]', value: 'eu-west-1' },
|
|
74
|
-
{ label: 'Europe (London) [eu-west-2]', value: 'eu-west-2' },
|
|
75
|
-
{ label: 'Europe (Milan) [eu-south-1]', value: 'eu-south-1' },
|
|
76
|
-
{ label: 'Europe (Paris) [eu-west-3]', value: 'eu-west-3' },
|
|
77
|
-
{ label: 'Europe (Spain) [eu-south-2]', value: 'eu-south-2' },
|
|
78
|
-
{
|
|
79
|
-
label: 'Europe (Stockholm) [eu-north-1]',
|
|
80
|
-
value: 'eu-north-1',
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
label: 'Europe (Zurich) [eu-central-2]',
|
|
84
|
-
value: 'eu-central-2',
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
label: 'South America (São Paulo) [sa-east-1]',
|
|
88
|
-
value: 'sa-east-1',
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
}),
|
|
93
|
-
},
|
|
94
|
-
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
95
|
-
try {
|
|
96
|
-
const client = (0, common_1.createBedrockClient)(auth);
|
|
97
|
-
yield client.send(new client_bedrock_1.ListFoundationModelsCommand({}));
|
|
98
|
-
return { valid: true };
|
|
99
|
-
}
|
|
100
|
-
catch (e) {
|
|
101
|
-
return {
|
|
102
|
-
valid: false,
|
|
103
|
-
error: e === null || e === void 0 ? void 0 : e.message,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
}),
|
|
107
|
-
required: true,
|
|
108
|
-
});
|
|
109
|
-
//# 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,qEAAqE;AACrE,qCAA+C;AAC/C,4DAAs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imeClient, ContentBlock, ConverseResponse } from '@aws-sdk/client-bedrock-runtime';
|
|
3
|
-
import { ApFile } from '@activepieces/pieces-framework';
|
|
4
|
-
export interface BedrockAuth {
|
|
5
|
-
accessKeyId: string;
|
|
6
|
-
secretAccessKey: string;
|
|
7
|
-
region: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function createBedrockClient(auth: BedrockAuth): BedrockClient;
|
|
10
|
-
export declare function createBedrockRuntimeClient(auth: BedrockAuth): BedrockRuntimeClient;
|
|
11
|
-
export declare function getBedrockModelOptions(auth: BedrockAuth | undefined, filters?: {
|
|
12
|
-
inputModality?: ModelModality;
|
|
13
|
-
outputModality?: ModelModality;
|
|
14
|
-
showAll?: boolean;
|
|
15
|
-
useInferenceProfiles?: boolean;
|
|
16
|
-
}): Promise<{
|
|
17
|
-
disabled: boolean;
|
|
18
|
-
placeholder: string;
|
|
19
|
-
options: never[];
|
|
20
|
-
} | {
|
|
21
|
-
disabled: boolean;
|
|
22
|
-
options: {
|
|
23
|
-
label: string;
|
|
24
|
-
value: string;
|
|
25
|
-
}[];
|
|
26
|
-
placeholder?: undefined;
|
|
27
|
-
}>;
|
|
28
|
-
export declare function buildS3ContentBlock(s3Bucket: string, s3Key: string): ContentBlock;
|
|
29
|
-
export declare function buildFileContentBlock(file: ApFile): ContentBlock;
|
|
30
|
-
export declare function extractConverseTextResponse(response: ConverseResponse): {
|
|
31
|
-
text: string;
|
|
32
|
-
stopReason: import("@aws-sdk/client-bedrock-runtime").StopReason | undefined;
|
|
33
|
-
usage: import("@aws-sdk/client-bedrock-runtime").TokenUsage | undefined;
|
|
34
|
-
latencyMs: number | undefined;
|
|
35
|
-
};
|
|
36
|
-
export declare function formatBedrockError(error: unknown): string;
|
|
37
|
-
//# sourceMappingURL=common.d.ts.map
|
package/src/lib/common.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/lib/common.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGb,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAEL,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,EAIjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,aAAa,CAQpE;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,WAAW,GAChB,oBAAoB,CAQtB;AAED,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,WAAW,GAAG,SAAS,EAC7B,OAAO,CAAC,EAAE;IACR,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;;;;;;;;;;;GAqGF;AA+CD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAoBjF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAoBhE;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,gBAAgB;;;;;EAarE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAwBzD"}
|