plenna_utilities 1.8.1 → 1.10.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/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from './src/mailer';
8
8
  export * from './src/airTable';
9
9
  export * from './src/alerts/presenter';
10
10
  export * from './src/common/domain/shared';
11
+ export * from './src/AI/bedrock';
package/dist/index.js CHANGED
@@ -29,3 +29,4 @@ __exportStar(require("./src/mailer"), exports);
29
29
  __exportStar(require("./src/airTable"), exports);
30
30
  __exportStar(require("./src/alerts/presenter"), exports);
31
31
  __exportStar(require("./src/common/domain/shared"), exports);
32
+ __exportStar(require("./src/AI/bedrock"), exports);
@@ -0,0 +1,10 @@
1
+ import { type PromptVariableValues } from '@aws-sdk/client-bedrock-runtime';
2
+ interface IPlennaBedrockArgs {
3
+ modelId: string;
4
+ }
5
+ export declare class PlennaBedrock {
6
+ private readonly modelId;
7
+ constructor(params: IPlennaBedrockArgs);
8
+ converse(variables: Record<string, PromptVariableValues>): Promise<string>;
9
+ }
10
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlennaBedrock = void 0;
4
+ const client_bedrock_runtime_1 = require("@aws-sdk/client-bedrock-runtime");
5
+ class PlennaBedrock {
6
+ modelId;
7
+ constructor(params) {
8
+ this.modelId = params.modelId;
9
+ }
10
+ async converse(variables) {
11
+ const client = new client_bedrock_runtime_1.BedrockRuntimeClient({ region: 'us-east-2' });
12
+ const command = new client_bedrock_runtime_1.ConverseCommand({
13
+ modelId: this.modelId,
14
+ promptVariables: variables
15
+ });
16
+ try {
17
+ const response = await client.send(command);
18
+ const summary = response?.output?.message?.content?.[0]?.text ?? 'No se pudo generar resumen';
19
+ return summary;
20
+ }
21
+ catch (err) {
22
+ console.error('Error en Bedrock:', err);
23
+ return 'Fallo al invocar Bedrock';
24
+ }
25
+ }
26
+ }
27
+ exports.PlennaBedrock = PlennaBedrock;
@@ -0,0 +1,4 @@
1
+ export type Without<T, K> = {
2
+ [P in Exclude<keyof T, keyof K>]?: never;
3
+ };
4
+ export type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -120,3 +120,11 @@ templates:
120
120
  text: "*Fecha de la cita:*\n{dateAppointment}"
121
121
  - type: mrkdwn
122
122
  text: "*Hora de la cita:*\n{hourAppointment}"
123
+ - type: divider
124
+ - type: section
125
+ fields:
126
+ - type: mrkdwn
127
+ text: "*¿Es paciente recurrente?:*\n{isRecurringPatient}"
128
+ - type: mrkdwn
129
+ text: "*Doctor@ en su health team:*\n{doctorRecurringPatient}"
130
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plenna_utilities",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "plenna's utils for backend projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,25 +25,27 @@
25
25
  "devDependencies": {
26
26
  "@types/aws-lambda": "^8.10.140",
27
27
  "@types/node": "^20.14.5",
28
+ "@types/yamljs": "^0.2.34",
28
29
  "@typescript-eslint/eslint-plugin": "^6.21.0",
29
30
  "eslint": "^8.57.0",
30
31
  "eslint-config-standard-with-typescript": "^43.0.1",
31
32
  "eslint-plugin-import": "^2.29.1",
32
33
  "eslint-plugin-n": "^16.6.2",
33
34
  "eslint-plugin-promise": "^6.1.1",
34
- "@types/yamljs": "^0.2.34",
35
35
  "typescript": "^5.4.5"
36
36
  },
37
37
  "dependencies": {
38
+ "@aws-sdk/client-bedrock-agent": "^3.600.0",
39
+ "@aws-sdk/client-bedrock-runtime": "^3.600.0",
38
40
  "@aws-sdk/client-s3": "^3.600.0",
39
41
  "@aws-sdk/s3-request-presigner": "^3.600.0",
40
42
  "@googleapis/docs": "^3.0.2",
41
43
  "@googleapis/drive": "^8.10.0",
42
44
  "@googleapis/sheets": "^8.0.0",
45
+ "@slack/web-api": "^6.9.1",
43
46
  "customerio-node": "^4.1.1",
47
+ "dotenv": "^16.4.5",
44
48
  "google-auth-library": "^9.11.0",
45
- "yaml": "^2.3.0",
46
- "@slack/web-api": "^6.9.1",
47
- "dotenv": "^16.4.5"
49
+ "yaml": "^2.3.0"
48
50
  }
49
51
  }