@activepieces/piece-amazon-bedrock 0.0.2

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.
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateEmbeddings = 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 index_1 = require("../../index");
9
+ const common_1 = require("../common");
10
+ exports.generateEmbeddings = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.awsBedrockAuth,
12
+ name: 'generate_embeddings',
13
+ displayName: 'Generate Embeddings',
14
+ description: 'Generate vector embeddings from text using Amazon Titan Embed, Cohere Embed, or Amazon Nova Multimodal Embeddings models.',
15
+ props: {
16
+ model: pieces_framework_1.Property.Dropdown({
17
+ displayName: 'Model',
18
+ required: true,
19
+ auth: index_1.awsBedrockAuth,
20
+ description: 'The embedding model to use.',
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, {
31
+ outputModality: client_bedrock_1.ModelModality.EMBEDDING,
32
+ });
33
+ }),
34
+ }),
35
+ inputText: pieces_framework_1.Property.LongText({
36
+ displayName: 'Input Text',
37
+ required: true,
38
+ description: 'The text to generate embeddings for.',
39
+ }),
40
+ embeddingPurpose: pieces_framework_1.Property.StaticDropdown({
41
+ displayName: 'Embedding Purpose',
42
+ required: false,
43
+ description: 'Optimize embeddings for your use case. Only used by Nova Multimodal Embeddings.',
44
+ defaultValue: 'GENERIC_INDEX',
45
+ options: {
46
+ options: [
47
+ { label: 'Generic Index', value: 'GENERIC_INDEX' },
48
+ { label: 'Generic Retrieval', value: 'GENERIC_RETRIEVAL' },
49
+ { label: 'Text Retrieval', value: 'TEXT_RETRIEVAL' },
50
+ { label: 'Classification', value: 'CLASSIFICATION' },
51
+ { label: 'Clustering', value: 'CLUSTERING' },
52
+ ],
53
+ },
54
+ }),
55
+ dimensions: pieces_framework_1.Property.Number({
56
+ displayName: 'Dimensions',
57
+ required: false,
58
+ description: 'The number of dimensions for the output embedding vector. Titan Embed v2: 256, 512, 1024. Nova Multimodal: 256, 384, 1024, 3072.',
59
+ }),
60
+ normalize: pieces_framework_1.Property.Checkbox({
61
+ displayName: 'Normalize',
62
+ required: false,
63
+ description: 'Whether to normalize the output embedding vector. Supported by Titan Embed v2.',
64
+ defaultValue: true,
65
+ }),
66
+ },
67
+ run(_a) {
68
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
69
+ var _b;
70
+ const client = (0, common_1.createBedrockRuntimeClient)(auth.props);
71
+ const { model, inputText, dimensions, normalize } = propsValue;
72
+ const isTitan = model.startsWith('amazon.titan-embed');
73
+ const isCohere = model.startsWith('cohere.embed');
74
+ const isNova = model.includes('nova') && model.includes('embed');
75
+ const isTwelveLabs = model.startsWith('twelvelabs.');
76
+ let requestBody;
77
+ if (isNova) {
78
+ requestBody = {
79
+ schemaVersion: 'nova-multimodal-embed-v1',
80
+ taskType: 'SINGLE_EMBEDDING',
81
+ singleEmbeddingParams: Object.assign(Object.assign({ embeddingPurpose: (_b = propsValue.embeddingPurpose) !== null && _b !== void 0 ? _b : 'GENERIC_INDEX' }, (dimensions != null ? { embeddingDimension: dimensions } : {})), { text: {
82
+ truncationMode: 'END',
83
+ value: inputText,
84
+ } }),
85
+ };
86
+ }
87
+ else if (isTitan) {
88
+ requestBody = Object.assign(Object.assign({ inputText }, (dimensions != null ? { dimensions } : {})), (normalize != null ? { normalize } : {}));
89
+ }
90
+ else if (isCohere) {
91
+ requestBody = {
92
+ texts: [inputText],
93
+ input_type: 'search_document',
94
+ truncate: 'END',
95
+ };
96
+ }
97
+ else if (isTwelveLabs) {
98
+ requestBody = {
99
+ inputType: 'text',
100
+ inputText,
101
+ textTruncate: 'end',
102
+ };
103
+ }
104
+ else {
105
+ requestBody = {
106
+ inputText,
107
+ };
108
+ }
109
+ try {
110
+ const response = yield client.send(new client_bedrock_runtime_1.InvokeModelCommand({
111
+ modelId: model,
112
+ body: Buffer.from(JSON.stringify(requestBody)),
113
+ contentType: 'application/json',
114
+ accept: 'application/json',
115
+ }));
116
+ const responseBody = JSON.parse(new TextDecoder().decode(response.body));
117
+ let embedding;
118
+ if (responseBody.embedding) {
119
+ // Titan Embed / TwelveLabs format: { embedding: [floats] }
120
+ embedding = responseBody.embedding;
121
+ }
122
+ else if (responseBody.embeddings &&
123
+ responseBody.embeddings.length > 0) {
124
+ const first = responseBody.embeddings[0];
125
+ if (Array.isArray(first)) {
126
+ // Cohere v3 format: { embeddings: [[floats]] }
127
+ embedding = first;
128
+ }
129
+ else if (first === null || first === void 0 ? void 0 : first.embedding) {
130
+ // Nova format: { embeddings: [{ embedding: [floats] }] }
131
+ embedding = first.embedding;
132
+ }
133
+ }
134
+ if (!embedding) {
135
+ throw new Error('No embedding was returned by the model. The response format may not be supported.');
136
+ }
137
+ return {
138
+ embedding,
139
+ dimensions: embedding.length,
140
+ model,
141
+ };
142
+ }
143
+ catch (error) {
144
+ if (error instanceof Error && error.message.includes('No embedding')) {
145
+ throw error;
146
+ }
147
+ throw new Error((0, common_1.formatBedrockError)(error));
148
+ }
149
+ });
150
+ },
151
+ });
152
+ //# sourceMappingURL=generate-embeddings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-embeddings.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/amazon-bedrock/src/lib/actions/generate-embeddings.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4EAAqE;AACrE,4DAAwD;AACxD,uCAA6C;AAC7C,sCAImB;AAEN,QAAA,k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S,EAAE,CAAC;oBAC3B,2DAA2D;oBAC3D,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;gBACrC,CAAC;qBAAM,IACL,YAAY,CAAC,UAAU;oBACvB,YAAY,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAClC,CAAC;oBACD,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;oBACzC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;wBACzB,+CAA+C;wBAC/C,SAAS,GAAG,KAAK,CAAC;oBACpB,CAAC;yBAAM,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,EAAE,CAAC;wBAC5B,yDAAyD;wBACzD,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;oBAC9B,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,SAAS,EAAE,CAAC;oBACf,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;gBACJ,CAAC;gBAED,OAAO;oBACL,SAAS;oBACT,UAAU,EAAE,SAAS,CAAC,MAAM;oBAC5B,KAAK;iBACN,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;oBACrE,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,IAAA,2BAAkB,EAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const generateImage: 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
+ negativePrompt: import("@activepieces/pieces-framework").LongTextProperty<false>;
13
+ width: import("@activepieces/pieces-framework").NumberProperty<false>;
14
+ height: import("@activepieces/pieces-framework").NumberProperty<false>;
15
+ seed: import("@activepieces/pieces-framework").NumberProperty<false>;
16
+ }>;
@@ -0,0 +1,139 @@
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 index_1 = require("../../index");
9
+ const common_1 = require("../common");
10
+ exports.generateImage = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.awsBedrockAuth,
12
+ name: 'generate_image',
13
+ displayName: 'Generate Image',
14
+ description: 'Generate an image from a text prompt using Amazon Titan Image Generator or Stability AI models.',
15
+ props: {
16
+ model: pieces_framework_1.Property.Dropdown({
17
+ displayName: 'Model',
18
+ required: true,
19
+ auth: index_1.awsBedrockAuth,
20
+ description: 'The image generation model to use.',
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, {
31
+ outputModality: client_bedrock_1.ModelModality.IMAGE,
32
+ });
33
+ }),
34
+ }),
35
+ prompt: pieces_framework_1.Property.LongText({
36
+ displayName: 'Prompt',
37
+ required: true,
38
+ description: 'A text description of the image you want to generate.',
39
+ }),
40
+ negativePrompt: pieces_framework_1.Property.LongText({
41
+ displayName: 'Negative Prompt',
42
+ required: false,
43
+ description: 'Describe what you do NOT want in the image. Helps refine the output.',
44
+ }),
45
+ width: pieces_framework_1.Property.Number({
46
+ displayName: 'Width',
47
+ required: false,
48
+ description: 'Image width in pixels. Must be supported by the model.',
49
+ defaultValue: 1024,
50
+ }),
51
+ height: pieces_framework_1.Property.Number({
52
+ displayName: 'Height',
53
+ required: false,
54
+ description: 'Image height in pixels. Must be supported by the model.',
55
+ defaultValue: 1024,
56
+ }),
57
+ seed: pieces_framework_1.Property.Number({
58
+ displayName: 'Seed',
59
+ required: false,
60
+ description: 'A seed for reproducible results. Use the same seed and prompt to get the same image.',
61
+ }),
62
+ },
63
+ run(_a) {
64
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue, files }) {
65
+ const client = (0, common_1.createBedrockRuntimeClient)(auth.props);
66
+ const { model, prompt, negativePrompt, width, height, seed } = propsValue;
67
+ const isTitan = model.startsWith('amazon.titan-image');
68
+ const isStability = model.startsWith('stability.');
69
+ const isNovaCanvas = model.startsWith('amazon.nova-canvas');
70
+ let requestBody;
71
+ if (isTitan) {
72
+ requestBody = {
73
+ taskType: 'TEXT_IMAGE',
74
+ textToImageParams: Object.assign({ text: prompt }, (negativePrompt ? { negativeText: negativePrompt } : {})),
75
+ 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 } : {})),
76
+ };
77
+ }
78
+ else if (isNovaCanvas) {
79
+ requestBody = {
80
+ taskType: 'TEXT_IMAGE',
81
+ textToImageParams: Object.assign({ text: prompt }, (negativePrompt ? { negativeText: negativePrompt } : {})),
82
+ 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 } : {})),
83
+ };
84
+ }
85
+ else if (isStability) {
86
+ requestBody = Object.assign({ text_prompts: [
87
+ { text: prompt, weight: 1 },
88
+ ...(negativePrompt
89
+ ? [{ text: negativePrompt, weight: -1 }]
90
+ : []),
91
+ ], 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 } : {}));
92
+ }
93
+ else {
94
+ requestBody = Object.assign({ text_prompts: [
95
+ { text: prompt, weight: 1 },
96
+ ...(negativePrompt
97
+ ? [{ text: negativePrompt, weight: -1 }]
98
+ : []),
99
+ ], width: width !== null && width !== void 0 ? width : 1024, height: height !== null && height !== void 0 ? height : 1024 }, (seed != null ? { seed: seed } : {}));
100
+ }
101
+ try {
102
+ const response = yield client.send(new client_bedrock_runtime_1.InvokeModelCommand({
103
+ modelId: model,
104
+ body: Buffer.from(JSON.stringify(requestBody)),
105
+ contentType: 'application/json',
106
+ accept: 'application/json',
107
+ }));
108
+ const responseBody = JSON.parse(new TextDecoder().decode(response.body));
109
+ let base64Image;
110
+ if (responseBody.images && responseBody.images.length > 0) {
111
+ base64Image = responseBody.images[0];
112
+ }
113
+ else if (responseBody.artifacts &&
114
+ responseBody.artifacts.length > 0) {
115
+ base64Image = responseBody.artifacts[0].base64;
116
+ }
117
+ if (!base64Image) {
118
+ throw new Error('No image was returned by the model. The response format may not be supported.');
119
+ }
120
+ const imageBuffer = Buffer.from(base64Image, 'base64');
121
+ const file = yield files.write({
122
+ fileName: 'generated-image.png',
123
+ data: imageBuffer,
124
+ });
125
+ return {
126
+ image: file,
127
+ model: model,
128
+ };
129
+ }
130
+ catch (error) {
131
+ if (error instanceof Error && error.message.includes('No image')) {
132
+ throw error;
133
+ }
134
+ throw new Error((0, common_1.formatBedrockError)(error));
135
+ }
136
+ });
137
+ },
138
+ });
139
+ //# sourceMappingURL=generate-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-image.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/amazon-bedrock/src/lib/actions/generate-image.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,4EAAqE;AACrE,4DAAwD;AACxD,uCAA6C;AAC7C,sCAImB;AAEN,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,sBAAc;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,sBAAc;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,+BAAsB,EAAC,IAAI,CAAC,KAAK,EAAE;oBACxC,cAAc,EAAE,8BAAa,CAAC,KAAK;iBACpC,CAAC,CAAC;YACL,CAAC,CAAA;SACF,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,uDAAuD;SACrE,CAAC;QACF,cAAc,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAChC,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,KAAK;YACf,WAAW,EACT,sEAAsE;SACzE,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,E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,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;gBACjD,CAAC;gBAED,IAAI,CAAC,WAAW,EAAE,CAAC;oBACjB,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;gBACJ,CAAC;gBAED,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;gBAEvD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;oBAC7B,QAAQ,EAAE,qBAAqB;oBAC/B,IAAI,EAAE,WAAW;iBAClB,CAAC,CAAC;gBAEH,OAAO;oBACL,KAAK,EAAE,IAAI;oBACX,KAAK,EAAE,KAAK;iBACb,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;oBACjE,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,MAAM,IAAI,KAAK,CAAC,IAAA,2BAAkB,EAAC,KAAK,CAAC,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ 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
+ }>;
@@ -0,0 +1,108 @@
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 index_1 = require("../../index");
8
+ const common_1 = require("../common");
9
+ exports.sendPrompt = (0, pieces_framework_1.createAction)({
10
+ auth: index_1.awsBedrockAuth,
11
+ name: 'send_prompt',
12
+ displayName: 'Ask Bedrock',
13
+ description: 'Send a text prompt to an Amazon Bedrock model.',
14
+ props: {
15
+ model: pieces_framework_1.Property.Dropdown({
16
+ displayName: 'Model',
17
+ required: true,
18
+ auth: index_1.awsBedrockAuth,
19
+ description: 'The foundation model to use for generation.',
20
+ refreshers: [],
21
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
22
+ if (!auth) {
23
+ return {
24
+ disabled: true,
25
+ placeholder: 'Connect your AWS account first',
26
+ options: [],
27
+ };
28
+ }
29
+ return (0, common_1.getBedrockModelOptions)(auth.props, { useInferenceProfiles: true });
30
+ }),
31
+ }),
32
+ prompt: pieces_framework_1.Property.LongText({
33
+ displayName: 'Prompt',
34
+ required: true,
35
+ }),
36
+ systemPrompt: pieces_framework_1.Property.LongText({
37
+ displayName: 'System Prompt',
38
+ required: false,
39
+ description: 'Instructions that guide the model behavior.',
40
+ }),
41
+ temperature: pieces_framework_1.Property.Number({
42
+ displayName: 'Temperature',
43
+ required: false,
44
+ description: 'Controls randomness. Lower values produce more deterministic output.',
45
+ defaultValue: 0.7,
46
+ }),
47
+ maxTokens: pieces_framework_1.Property.Number({
48
+ displayName: 'Maximum Tokens',
49
+ required: false,
50
+ description: 'The maximum number of tokens to generate.',
51
+ defaultValue: 2048,
52
+ }),
53
+ topP: pieces_framework_1.Property.Number({
54
+ displayName: 'Top P',
55
+ required: false,
56
+ description: 'Nucleus sampling: the model considers tokens with top_p probability mass.',
57
+ defaultValue: 1,
58
+ }),
59
+ stopSequences: pieces_framework_1.Property.Array({
60
+ displayName: 'Stop Sequences',
61
+ required: false,
62
+ description: 'Sequences that will cause the model to stop generating. Up to 4 sequences.',
63
+ }),
64
+ memoryKey: pieces_framework_1.Property.ShortText({
65
+ displayName: 'Memory Key',
66
+ required: false,
67
+ description: 'A memory key that will keep the chat history shared across runs and flows. Keep it empty to leave the model without memory of previous messages.',
68
+ }),
69
+ },
70
+ run(_a) {
71
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue, store }) {
72
+ var _b, _c;
73
+ const client = (0, common_1.createBedrockRuntimeClient)(auth.props);
74
+ const { model, prompt, systemPrompt, temperature, maxTokens, topP, stopSequences, memoryKey, } = propsValue;
75
+ let messageHistory = [];
76
+ if (memoryKey) {
77
+ messageHistory =
78
+ (_b = (yield store.get(memoryKey, pieces_framework_1.StoreScope.PROJECT))) !== null && _b !== void 0 ? _b : [];
79
+ }
80
+ messageHistory.push({
81
+ role: client_bedrock_runtime_1.ConversationRole.USER,
82
+ content: [{ text: prompt }],
83
+ });
84
+ try {
85
+ const response = yield client.send(new client_bedrock_runtime_1.ConverseCommand(Object.assign(Object.assign({ modelId: model, messages: messageHistory }, (systemPrompt ? { system: [{ text: systemPrompt }] } : {})), { inferenceConfig: {
86
+ temperature: temperature !== null && temperature !== void 0 ? temperature : undefined,
87
+ maxTokens: maxTokens !== null && maxTokens !== void 0 ? maxTokens : undefined,
88
+ topP: topP !== null && topP !== void 0 ? topP : undefined,
89
+ stopSequences: stopSequences && stopSequences.length > 0
90
+ ? stopSequences
91
+ : undefined,
92
+ } })));
93
+ const outputMessage = (_c = response.output) === null || _c === void 0 ? void 0 : _c.message;
94
+ if (outputMessage) {
95
+ messageHistory.push(outputMessage);
96
+ }
97
+ if (memoryKey) {
98
+ yield store.put(memoryKey, messageHistory, pieces_framework_1.StoreScope.PROJECT);
99
+ }
100
+ return (0, common_1.extractConverseTextResponse)(response);
101
+ }
102
+ catch (error) {
103
+ throw new Error((0, common_1.formatBedrockError)(error));
104
+ }
105
+ });
106
+ },
107
+ });
108
+ //# sourceMappingURL=send-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-prompt.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/amazon-bedrock/src/lib/actions/send-prompt.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,4EAIyC;AACzC,uCAA6C;AAC7C,sCAKmB;AAEN,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,sBAAc;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,sBAAc;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,EAAE;qBACZ,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAA,+BAAsB,EAAC,IAAI,CAAC,KAAK,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAA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,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"}
@@ -0,0 +1,33 @@
1
+ import { BedrockClient, ModelModality } from '@aws-sdk/client-bedrock';
2
+ import { BedrockRuntimeClient, ConverseResponse } from '@aws-sdk/client-bedrock-runtime';
3
+ export interface BedrockAuth {
4
+ accessKeyId: string;
5
+ secretAccessKey: string;
6
+ region: string;
7
+ }
8
+ export declare function createBedrockClient(auth: BedrockAuth): BedrockClient;
9
+ export declare function createBedrockRuntimeClient(auth: BedrockAuth): BedrockRuntimeClient;
10
+ export declare function getBedrockModelOptions(auth: BedrockAuth | undefined, filters?: {
11
+ inputModality?: ModelModality;
12
+ outputModality?: ModelModality;
13
+ showAll?: boolean;
14
+ useInferenceProfiles?: boolean;
15
+ }): Promise<{
16
+ disabled: boolean;
17
+ placeholder: string;
18
+ options: never[];
19
+ } | {
20
+ disabled: boolean;
21
+ options: {
22
+ label: string;
23
+ value: string;
24
+ }[];
25
+ placeholder?: undefined;
26
+ }>;
27
+ export declare function extractConverseTextResponse(response: ConverseResponse): {
28
+ text: string;
29
+ stopReason: import("@aws-sdk/client-bedrock-runtime").StopReason | undefined;
30
+ usage: import("@aws-sdk/client-bedrock-runtime").TokenUsage | undefined;
31
+ latencyMs: number | undefined;
32
+ };
33
+ export declare function formatBedrockError(error: unknown): string;