@awell-health/awell-extensions 2.0.208 → 2.0.209

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.
@@ -152,7 +152,7 @@
152
152
  "changelog": "# Salesforce changelog"
153
153
  },
154
154
  "shelly": {
155
- "readme": "---\ntitle: Shelly\ndescription: Library of AI-powered actions\n---\n\n# Shelly\n\nShelly is a library of AI-powered actions for enhancing workflow automation and data processing. It includes the following actions:\n\n1. **summarizeForm**: Summarizes form data (last form in a step)\n2. **summarizeFormsInStep**: Summarizes all forms within a step.\n3. **summarizeCareFlow**: Provides a summary of a care flow.\n4. **categorizeMessage**: Categorizes messages or content.\n5. **generateMessage**: Generates personalized messages.\n6. **medicationFromImage**: Extracts medication information from images.\n7. **reviewMedicationExtraction**: Reviews and validates extracted medication information.\n8. **summarizeTrackOutcome**: Provides an AI-generated summary of track activities and overall track outcomes.",
155
+ "readme": "---\ntitle: Shelly\ndescription: Library of AI-powered actions\n---\n\n# Shelly\n\nShelly is a library of AI-powered actions for enhancing workflow automation and data processing. It leverages advanced language models and specialized APIs to provide intelligent automation capabilities.\n\n## Actions\n\n### Categorize Message\nUses AI to classify messages into predefined categories.\n\n- Analyzes message content using LLM\n- Matches against provided categories\n- Provides explanation for the categorization\n\nFeatures:\n- Supports custom category lists\n- Handles multiple languages\n- Returns \"None\" if no category matches\n- Includes detailed explanation of the classification\n\n### Generate Message\nCreates personalized messages using AI.\n\n- Takes communication objective and context\n- Generates appropriate message content\n- Formats according to stakeholder needs\n\nFeatures:\n- Customizable tone and style\n- Multi-language support\n- Personalization based on recipient data\n- Context-aware message generation\n\n### Medication From Image\nExtracts structured medication information from images.\n\n- Processes uploaded medication images\n- Uses specialized API for text extraction\n- Returns structured medication data\n\nFeatures:\n- Extracts medication names, dosages, and instructions\n- Supports various image formats\n- Returns both structured data and text summary\n- Includes error handling for unclear images\n\n### Review Medication Extraction\nAllows stakeholders to review and validate extracted medication information.\n\n- Displays extracted medication data\n- Provides interface for validation\n- Captures reviewer feedback\n\nFeatures:\n- Side-by-side image and data comparison\n- Validation workflow\n- Support for corrections and annotations\n\n### Summarize Care Flow\nProvides an AI-generated summary of the entire care flow progress.\n\n- Collects all relevant care flow data\n- Analyzes activities and outcomes\n- Generates a comprehensive summary\n\nFeatures:\n- Customizable for different stakeholders (e.g., clinicians, patients)\n- Optional focus areas through additional instructions\n- Includes relevant context and disclaimers\n\n### Summarize Form\nUses AI to generate concise summaries of form responses.\n\n- Retrieves the latest form data from the current step\n- Processes form responses with an LLM\n- Generates a structured summary in the specified format\n\nFeatures:\n- Supports bullet-point or paragraph format\n- Customizable language selection\n- Optional additional instructions for focused summaries\n- Includes context-aware disclaimers\n\n### Summarize Forms in Step\nSimilar to summarizeForm but processes all forms within a step.\n\nFeatures:\n- Combines data from multiple forms\n- Maintains context between form responses\n- Same formatting options as single form summaries\n\n### Summarize Track Outcome\nGenerates comprehensive summaries of track activities and outcomes.\n\n- Analyzes track data and activities\n- Identifies key outcomes and decisions\n- Creates structured summary\n\nFeatures:\n- Customizable focus areas\n- Support for specific outcome analysis\n- Flexible formatting options\n- Context-aware summaries",
156
156
  "changelog": "# Shelly changelog"
157
157
  },
158
158
  "stripe": {
@@ -107,6 +107,13 @@ declare const actions: {
107
107
  type: import("@awell-health/extensions-core").FieldType.STRING;
108
108
  required: false;
109
109
  };
110
+ additionalInstructions: {
111
+ id: string;
112
+ label: string;
113
+ description: string;
114
+ type: import("@awell-health/extensions-core").FieldType.TEXT;
115
+ required: false;
116
+ };
110
117
  }, Record<string, never>, "summary">;
111
118
  summarizeFormsInStep: import("@awell-health/extensions-core").Action<{
112
119
  summaryFormat: {
@@ -25,14 +25,24 @@ export declare const fields: {
25
25
  type: FieldType.STRING;
26
26
  required: false;
27
27
  };
28
+ additionalInstructions: {
29
+ id: string;
30
+ label: string;
31
+ description: string;
32
+ type: FieldType.TEXT;
33
+ required: false;
34
+ };
28
35
  };
29
36
  export declare const FieldsValidationSchema: z.ZodObject<{
30
37
  summaryFormat: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodEnum<[SummaryFormatEnum.BULLET_POINTS, SummaryFormatEnum.TEXT_PARAGRAPH]>>>, SummaryFormatEnum, SummaryFormatEnum | undefined>;
31
38
  language: z.ZodDefault<z.ZodOptional<z.ZodString>>;
39
+ additionalInstructions: z.ZodDefault<z.ZodOptional<z.ZodString>>;
32
40
  }, "strip", z.ZodTypeAny, {
33
41
  language: string;
42
+ additionalInstructions: string;
34
43
  summaryFormat: SummaryFormatEnum;
35
44
  }, {
36
45
  language?: string | undefined;
46
+ additionalInstructions?: string | undefined;
37
47
  summaryFormat?: SummaryFormatEnum | undefined;
38
48
  }>;
@@ -6,13 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FieldsValidationSchema = exports.fields = exports.SummaryFormatEnum = void 0;
7
7
  const extensions_core_1 = require("@awell-health/extensions-core");
8
8
  const zod_1 = __importDefault(require("zod"));
9
- // Step 1: Define the enum
10
9
  var SummaryFormatEnum;
11
10
  (function (SummaryFormatEnum) {
12
11
  SummaryFormatEnum["BULLET_POINTS"] = "Bullet-points";
13
12
  SummaryFormatEnum["TEXT_PARAGRAPH"] = "Text paragraph";
14
13
  })(SummaryFormatEnum || (exports.SummaryFormatEnum = SummaryFormatEnum = {}));
15
- // Step 2: Define the fields object
16
14
  exports.fields = {
17
15
  summaryFormat: {
18
16
  id: 'summaryFormat',
@@ -34,6 +32,13 @@ exports.fields = {
34
32
  type: extensions_core_1.FieldType.STRING,
35
33
  required: false,
36
34
  },
35
+ additionalInstructions: {
36
+ id: 'additionalInstructions',
37
+ label: 'Additional Instructions',
38
+ description: '[Optional] Specify additional instructions for the AI to generate the form summary. You can include details about: specific questions to focus on, desired level of detail, information to emphasize or exclude, etc.',
39
+ type: extensions_core_1.FieldType.TEXT,
40
+ required: false,
41
+ },
37
42
  };
38
43
  // Step 3: Define the validation schema using zod
39
44
  exports.FieldsValidationSchema = zod_1.default.object({
@@ -45,5 +50,6 @@ exports.FieldsValidationSchema = zod_1.default.object({
45
50
  ? value
46
51
  : SummaryFormatEnum.BULLET_POINTS),
47
52
  language: zod_1.default.string().optional().default('Default'),
53
+ additionalInstructions: zod_1.default.string().optional().default('No additional instructions'),
48
54
  });
49
55
  //# sourceMappingURL=fields.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/summarizeForm/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAExC,0BAA0B;AAC1B,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oDAA+B,CAAA;IAC/B,sDAAiC,CAAA;AACnC,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,mCAAmC;AACtB,QAAA,MAAM,GAAG;IACpB,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,+GAA+G;QACjH,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE;YACP,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACjE,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;SACJ;KACF;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,WAAW,EACT,iFAAiF;QACnF,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEjC,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,aAAC;SACb,IAAI,CAAC,CAAC,iBAAiB,CAAC,aAAa,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;SACzE,QAAQ,EAAE;SACV,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC;SACxC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CACnB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,KAA0B,CAAC;QACnE,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,iBAAiB,CAAC,aAAa,CACpC;IACH,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;CACD,CAAC,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/summarizeForm/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAExC,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oDAA+B,CAAA;IAC/B,sDAAiC,CAAA;AACnC,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAEY,QAAA,MAAM,GAAG;IACpB,aAAa,EAAE;QACb,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,+GAA+G;QACjH,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE;YACP,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACjE,KAAK,EAAE,MAAM;gBACb,KAAK,EAAE,MAAM;aACd,CAAC,CAAC;SACJ;KACF;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;QACjB,WAAW,EACT,iFAAiF;QACnF,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,uNAAuN;QACzN,IAAI,EAAE,2BAAS,CAAC,IAAI;QACpB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEjC,iDAAiD;AACpC,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,aAAa,EAAE,aAAC;SACb,IAAI,CAAC,CAAC,iBAAiB,CAAC,aAAa,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;SACzE,QAAQ,EAAE;SACV,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC;SACxC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CACnB,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,KAA0B,CAAC;QACnE,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,iBAAiB,CAAC,aAAa,CACpC;IACH,QAAQ,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IAClD,sBAAsB,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC;CAClC,CAAC,CAAA"}
@@ -9,7 +9,6 @@ const config_1 = require("./config");
9
9
  const getFormResponseText_1 = require("../../lib/getFormResponseText");
10
10
  const awell_1 = require("../../../../src/lib/awell");
11
11
  const utils_1 = require("../../../../src/utils");
12
- const constants_2 = require("../../lib/constants");
13
12
  /**
14
13
  * Awell Action: Form Summarization
15
14
  *
@@ -28,8 +27,9 @@ exports.summarizeForm = {
28
27
  previewable: false,
29
28
  dataPoints: config_1.dataPoints,
30
29
  onEvent: async ({ payload, onComplete, onError, helpers }) => {
30
+ var _a, _b, _c, _d, _e, _f;
31
31
  // 1. Validate input fields
32
- const { summaryFormat, language } = config_1.FieldsValidationSchema.parse(payload.fields);
32
+ const { summaryFormat, language, additionalInstructions } = config_1.FieldsValidationSchema.parse(payload.fields);
33
33
  // 2. Initialize OpenAI model with metadata
34
34
  const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
35
35
  settings: {}, // we use built-in API key for OpenAI
@@ -38,9 +38,25 @@ exports.summarizeForm = {
38
38
  modelType: constants_1.OPENAI_MODELS.GPT4o,
39
39
  hideDataForTracing: true, // Hide input and output data when tracing
40
40
  });
41
+ const awellSdk = await helpers.awellSdk();
42
+ // Get pathway details for the disclaimer
43
+ const pathwayDetails = await awellSdk.orchestration.query({
44
+ pathway: {
45
+ __args: {
46
+ id: payload.pathway.id,
47
+ },
48
+ code: true,
49
+ success: true,
50
+ pathway: {
51
+ id: true,
52
+ title: true,
53
+ pathway_definition_id: true,
54
+ },
55
+ },
56
+ });
41
57
  // 3. Get form data
42
58
  const { formDefinition, formResponse } = await (0, awell_1.getLatestFormInCurrentStep)({
43
- awellSdk: await helpers.awellSdk(),
59
+ awellSdk,
44
60
  pathwayId: payload.pathway.id,
45
61
  activityId: payload.activity.id,
46
62
  });
@@ -54,7 +70,8 @@ exports.summarizeForm = {
54
70
  formData,
55
71
  summaryFormat,
56
72
  language,
57
- disclaimerMessage: constants_2.DISCLAIMER_MSG_FORM,
73
+ disclaimerMessage: `Important Notice: The content provided is an AI-generated summary of form responses in Care Flow "${(_c = (_b = (_a = pathwayDetails.pathway) === null || _a === void 0 ? void 0 : _a.pathway) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : 'Unknown'}" (ID: ${(_f = (_e = (_d = pathwayDetails.pathway) === null || _d === void 0 ? void 0 : _d.pathway) === null || _e === void 0 ? void 0 : _e.pathway_definition_id) !== null && _f !== void 0 ? _f : 'Unknown'}).`,
74
+ additionalInstructions,
58
75
  metadata,
59
76
  callbacks,
60
77
  });
@@ -1 +1 @@
1
- {"version":3,"file":"summarizeForm.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/summarizeForm/summarizeForm.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,yEAAqE;AACrE,wFAAoF;AACpF,wEA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KAAK;YACL,QAAQ;YACR,aAAa;YACb,QAAQ;YACR,iBAAiB,EAAE,+BAAmB;YACtC,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,+BAA+B;QAC/B,MAAM,WAAW,GAAG,MAAM,IAAA,sBAAc,EAAC,OAAO,CAAC,CAAA;QACjD,MAAM,UAAU,CAAC;YACf,WAAW,EAAE;gBACX,OAAO,EAAE,WAAW;aACrB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
1
+ {"version":3,"file":"summarizeForm.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/summarizeForm/summarizeForm.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,yEAAqE;AACrE,wFAAoF;AACpF,wEAAwE;AACxE,qCAAqE;AACrE,uEAAmE;AACnE,qDAAsE;AACtE,iDAAsD;AAEtD;;;;;;;;GAQG;AACU,QAAA,aAAa,GAItB;IACF,GAAG,EAAE,eAAe;IACpB,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,0DAA0D;IACvE,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IAEV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;;QAC1E,2BAA2B;QAC3B,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,sBAAsB,EAAE,GAAG,+BAAsB,CAAC,KAAK,CACtF,OAAO,CAAC,MAAM,CACf,CAAA;QAED,2CAA2C;QAC3C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC;YAC7D,QAAQ,EAAE,EAAE,EAAE,qCAAqC;YACnD,OAAO;YACP,OAAO;YACP,SAAS,EAAE,yBAAa,CAAC,KAAK;YAC9B,kBAAkB,EAAE,IAAI,EAAE,0CAA0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AAW,EAAE;gBACX,OAAO,EAAE,WAAW;aACrB;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
@@ -71,12 +71,12 @@ exports.getFormTitle = getFormTitle;
71
71
  const getFormResponseText = (opts) => {
72
72
  const formAnswers = [];
73
73
  const omittedFormAnswers = [];
74
- opts.formResponse.answers.forEach((questionResponse) => {
75
- const questionDefinition = opts.formDefinition.questions.find((q) => q.id === questionResponse.question_id);
76
- if (questionDefinition === undefined) {
74
+ opts.formDefinition.questions.forEach((questionDefinition) => {
75
+ const questionResponse = opts.formResponse.answers.find((a) => a.question_id === questionDefinition.id);
76
+ if (questionResponse === undefined) {
77
77
  omittedFormAnswers.push({
78
- questionId: questionResponse.question_id,
79
- reason: 'No corresponding question definition found in the form definition',
78
+ questionId: questionDefinition.id,
79
+ reason: 'No corresponding answer found in the form response',
80
80
  });
81
81
  return;
82
82
  }
@@ -87,7 +87,7 @@ const getFormResponseText = (opts) => {
87
87
  catch (error) {
88
88
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
89
89
  omittedFormAnswers.push({
90
- questionId: questionResponse.question_id,
90
+ questionId: questionDefinition.id,
91
91
  reason: `Error processing answer: ${errorMessage}`,
92
92
  });
93
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getFormResponseText.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/getFormResponseText/getFormResponseText.ts"],"names":[],"mappings":";;;AAOA,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE;IAClD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,YAAY,CAAA;IAEvC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,aAAa,CAAA;IAExC,OAAO,iBAAiB,CAAA;AAC1B,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAC5B,kBAA4B,EAC5B,gBAAwB,EAChB,EAAE;;IACV,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAA;IAC1C,MAAM,aAAa,GAAG,MAA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,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAChD,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAC1C,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,qBAAqB;QAC7B,kBAAkB,EAAE,iBAAiB;KACtC,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,uBAAuB,2BAoClC"}
1
+ {"version":3,"file":"getFormResponseText.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/getFormResponseText/getFormResponseText.ts"],"names":[],"mappings":";;;AAOA,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE;IAClD,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,YAAY,CAAA;IAEvC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,aAAa,CAAA;IAExC,OAAO,iBAAiB,CAAA;AAC1B,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAC5B,kBAA4B,EAC5B,gBAAwB,EAChB,EAAE;;IACV,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,CAAA;IAC1C,MAAM,aAAa,GAAG,MAAA,kBAAkB,CAAC,OAAO,mCAAI,EAAE,CAAA;IAEtD,MAAM,gBAAgB,GAAG,aAAa,aAAb,aAAa,uBAAb,aAAa,CAClC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACf,OAAO,KAAK,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,YAAY,GAAG,CAAA;IACrD,CAAC,EACA,IAAI,CAAC,IAAI,CAAC,CAAA;IAEb,MAAM,WAAW,GAAG,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CACrC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,YAAY,KAAK,WAAW,CAC5D,0CAAE,KAAK,CAAA;IAER,OAAO,sBAAsB,gBAAgB,aAAa,MAAM,CAC9D,WAAW,CACZ,EAAE,CAAA;AACL,CAAC,CAAA;AAED,MAAM,wBAAwB,GAA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ACH,CAAC,CAAA;AA1CY,QAAA,mBAAmB,uBA0C/B;AAGM,MAAM,uBAAuB,GAAG,CAAC,IAOvC,EAGC,EAAE;IAEF,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QACvD,MAAM,gBAAgB,GAAG,IAAA,2BAAmB,EAAC;YAC3C,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,YAAY,EAAE,QAAQ,CAAC,YAAY;SACpC,CAAC,CAAC;QACH,OAAO;YACL,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,GAAG,gBAAgB;SACpB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,qBAAqB,GAAG,gBAAgB;SAC3C,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,qBAAqB,QAAQ,CAAC,cAAc,cAAc,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;SAClH,IAAI,CAAC,uCAAuC,CAAC,CAAC;IAEjD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,OAAO,CAChD,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAC1C,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,qBAAqB;QAC7B,kBAAkB,EAAE,iBAAiB;KACtC,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,uBAAuB,2BAoClC"}
@@ -1,3 +1,3 @@
1
1
  import { ChatPromptTemplate } from '@langchain/core/prompts';
2
- export declare const systemPromptBulletPoints: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant tasked with summarizing forms completed by patients. Each form contains a title, questions, answers, possibly answer labels and answer options. Your objective is to create a concise summary of the patient's responses, tailored for a team of clinicians involved in patient care. The summary must cover all patient questions and provide an easy-to-review overview.\n\n First, write the disclaimer message \"{disclaimerMessage}\" in specified language: {language}, following these rules:\n - If specified language is Default or not specified: translate all parts of {disclaimerMessage} into the language of the form. If you cannot determine language use English.\n - If specified language is other than Default (French, Spanish, bosnian, ...): translate all parts of {disclaimerMessage} into specified language: {language} It is critical that the entire disclaimer message is written in the same language as specified language: {language}.\n For example if the disclaimer message is \"Important Notice: The content provided is an AI-generated summary.\" and specified language is Spanish, the disclaimer message in Spanish would be \"Aviso Importante: El contenido proporcionado es un resumen generado por IA de las respuestas del formulario\".\n If the specified language is French than the same disclaimer message should be: \"Avis Important : Le contenu fourni est un résumé généré par IA des réponses du formulaire\"\n Then add two new lines after the disclaimer message.\n\n Then adhere strictly to these step-by-step instructions:\n 1. **Begin the summary with the form title if available.**\n - Use title as is without alteration. Format is as title. \n - Then add an empty line for separation. \n\n - *For example:*\n - **General Health Questionnaire**\n - *Empty Line*\n \n 2. **Identify all questions and their corresponding answers.**\n\n 3. **Structure the summary using bullet points in clear and correct Markdown format:**\n\n - Use the format: `• **Question** - Answer`\n - **Ensure the answer is informative:**\n - For multiple-choice questions where the raw answer may be a code (e.g., 0, 1) that lacks meaning on its own, use the associated **answer label** instead.\n - For other questions, use the raw answer if it is clear and informative.\n\n 4. **Enhance conciseness and readability:**\n\n - **Shorten lengthy questions and answers to their essential meaning for easier inspection, while preserving all essential context.**\n - *For example:*\n - **Before**: \"Can you describe the nature of your back pain?\"\n - **After**: \"Nature of back pain\"\n - **Before**: \"Please list any medications you are currently taking, including dosages and frequency.\"\n - **After**: \"Current medications (dosage and frequency)\"\n - **Before**: \"Have you experienced any side effects from your current treatment in the last 3 months?\"\n - **After**: \"Side effects from current treatment in the last 3 months\"\n - **Avoid omitting any key information** that might alter the meaning. It is critical to preserve all time frames (e.g., \"last week,\" \"yesterday\") and specific details (e.g., \"right leg,\" \"morning\").\n\n 5. **If there are multiple forms provided, add a new line and proceed with the next form.**\n\n **Important Notes:**\n\n - Absolutely refrain from making any suggestions, interpretations, or provide additional comments.\n\n **Style and Format Guidelines:**\n\n - Use **professional and informative language**, avoiding colloquialisms and overly technical terms.\n - Ensure the summary is **clear**, **concise**, and **easy to read**.\n\n **Language:**\n\n - It is critical to summarize in the language specified below. If Default or not specified, use the language of the form.\n\n **Specified Language:**\n\n {language}\n\n ---\n\n **Content to Summarize:**\n\n {input}\n">, any>;
3
- export declare const systemPromptTextParagraph: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant tasked with summarizing forms completed by patients. Each form contains a title, questions, answers, answer labels, and possible answer options. Your objective is to create a concise summary of the patient's responses, tailored for a team of clinicians involved in patient care. The summary must provide an easy-to-review overview.\n\n First, write the disclaimer message \"{disclaimerMessage}\" in specified language: {language}, following these rules:\n - If specified language is Default or not specified: translate all parts of {disclaimerMessage} into the language of the form. If you cannot determine language use English.\n - If specified language is other than Default (French, Spanish, bosnian, ...): translate all parts of {disclaimerMessage} into specified language: {language} It is critical that the entire disclaimer message is written in the same language as specified language: {language}.\n For example if the disclaimer message is \"Important Notice: The content provided is an AI-generated summary.\" and specified language is Spanish, the disclaimer message in Spanish would be \"Aviso Importante: El contenido proporcionado es un resumen generado por IA de las respuestas del formulario\".\n If the specified language is French than the same disclaimer message should be: \"Avis Important : Le contenu fourni est un résumé généré par IA des réponses du formulaire\"\n Then add two new lines after the disclaimer message.\n \n Then adhere strictly to these step-by-step instructions:\n\n 1. **Begin the summary with the form title if available.**\n - Use title as is without alteration. Format is as title. \n - Then add an empty line for separation. \n\n - *For example:*\n - **General Health Questionnaire**\n - *Empty Line*\n\n 2. **Identify all questions and their corresponding answers.**\n\n 3. **Compose the summary as an informative, easy-to-read paragraph:**\n\n - Cover all important aspects of the patient's responses.\n - Ensure the summary is **concise** and **to the point** while preserving all essential information.\n - **Write everything in one paragraph**, maintaining a logical flow of information.\n - For multiple-choice questions where the raw answer may be a code (e.g., 0, 1) that lacks meaning on its own, use the associated **answer label** instead. \n\n\n **Important Notes:**\n\n - Do not make any conclusions, suggestions, interpretations, or provide additional comments. Only summarize the information provided in the form.\n\n **Style and Format Guidelines:**\n\n - Use **professional and informative language**, avoiding colloquialisms and overly technical terms.\n - Ensure the summary is **clear**, **concise**, and **easy to read**.\n\n **Language:**\n\n - It is critical to summarize in the language specified below. If Default or not specified, use the language of the form.\n\n **Specified Language:**\n\n {language}\n\n ---\n\n **Content to Summarize:**\n\n {input}\n">, any>;
2
+ export declare const systemPromptBulletPoints: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant tasked with summarizing forms completed by patients. Each form contains a title, questions, answers, possibly answer labels and answer options. Your objective is to create a concise summary of the patient's responses, tailored for a team of clinicians involved in patient care. The summary must cover all patient questions and provide an easy-to-review overview.\n\n First, write the disclaimer message \"{disclaimerMessage}\" in specified language: {language}, following these rules:\n - If specified language is Default or not specified: translate all parts of {disclaimerMessage} into the language of the form. If you cannot determine language use English.\n - If specified language is other than Default (French, Spanish, bosnian, ...): translate all parts of {disclaimerMessage} into specified language: {language} It is critical that the entire disclaimer message is written in the same language as specified language: {language}.\n For example if the disclaimer message is \"Important Notice: The content provided is an AI-generated summary.\" and specified language is Spanish, the disclaimer message in Spanish would be \"Aviso Importante: El contenido proporcionado es un resumen generado por IA de las respuestas del formulario\".\n If the specified language is French than the same disclaimer message should be: \"Avis Important : Le contenu fourni est un résumé généré par IA des réponses du formulaire\"\n Then add two new lines after the disclaimer message.\n\n Then adhere strictly to these step-by-step instructions:\n 1. **Begin the summary with the form title if available.**\n - Use title as is without alteration. Format is as title. \n - Then add an empty line for separation. \n\n - *For example:*\n - **General Health Questionnaire**\n - *Empty Line*\n \n 2. **Identify all questions and their corresponding answers.**\n\n 3. **Structure the summary using bullet points in clear and correct Markdown format:**\n\n - Use the format: `• **Question** - Answer`\n - **Ensure the answer is informative:**\n - For multiple-choice questions where the raw answer may be a code (e.g., 0, 1) that lacks meaning on its own, use the associated **answer label** instead.\n - For other questions, use the raw answer if it is clear and informative.\n\n 4. **Enhance conciseness and readability:**\n\n - **Shorten lengthy questions and answers to their essential meaning for easier inspection, while preserving all essential context.**\n - *For example:*\n - **Before**: \"Can you describe the nature of your back pain?\"\n - **After**: \"Nature of back pain\"\n - **Before**: \"Please list any medications you are currently taking, including dosages and frequency.\"\n - **After**: \"Current medications (dosage and frequency)\"\n - **Before**: \"Have you experienced any side effects from your current treatment in the last 3 months?\"\n - **After**: \"Side effects from current treatment in the last 3 months\"\n - **Avoid omitting any key information** that might alter the meaning. It is critical to preserve all time frames (e.g., \"last week,\" \"yesterday\") and specific details (e.g., \"right leg,\" \"morning\").\n\n 5. **If there are multiple forms provided, add a new line and proceed with the next form.**\n\n **Important Notes:**\n\n - Absolutely refrain from making any suggestions, interpretations, or provide additional comments.\n\n **Style and Format Guidelines:**\n\n - Use **professional and informative language**, avoiding colloquialisms and overly technical terms.\n - Ensure the summary is **clear**, **concise**, and **easy to read**.\n\n **Language:**\n\n - It is critical to summarize in the language specified below. If Default or not specified, use the language of the form.\n\n **Specified Language:**\n\n {language}\n\n **Additional Instructions:**\n {additionalInstructions}\n\n ---\n\n **Content to Summarize:**\n\n {input}\n">, any>;
3
+ export declare const systemPromptTextParagraph: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant tasked with summarizing forms completed by patients. Each form contains a title, questions, answers, answer labels, and possible answer options. Your objective is to create a concise summary of the patient's responses, tailored for a team of clinicians involved in patient care. The summary must provide an easy-to-review overview.\n\n First, write the disclaimer message \"{disclaimerMessage}\" in specified language: {language}, following these rules:\n - If specified language is Default or not specified: translate all parts of {disclaimerMessage} into the language of the form. If you cannot determine language use English.\n - If specified language is other than Default (French, Spanish, bosnian, ...): translate all parts of {disclaimerMessage} into specified language: {language} It is critical that the entire disclaimer message is written in the same language as specified language: {language}.\n For example if the disclaimer message is \"Important Notice: The content provided is an AI-generated summary.\" and specified language is Spanish, the disclaimer message in Spanish would be \"Aviso Importante: El contenido proporcionado es un resumen generado por IA de las respuestas del formulario\".\n If the specified language is French than the same disclaimer message should be: \"Avis Important : Le contenu fourni est un résumé généré par IA des réponses du formulaire\"\n Then add two new lines after the disclaimer message.\n \n Then adhere strictly to these step-by-step instructions:\n\n 1. **Begin the summary with the form title if available.**\n - Use title as is without alteration. Format is as title. \n - Then add an empty line for separation. \n\n - *For example:*\n - **General Health Questionnaire**\n - *Empty Line*\n\n 2. **Identify all questions and their corresponding answers.**\n\n 3. **Compose the summary as an informative, easy-to-read paragraph:**\n\n - Cover all important aspects of the patient's responses.\n - Ensure the summary is **concise** and **to the point** while preserving all essential information.\n - **Write everything in one paragraph**, maintaining a logical flow of information.\n - For multiple-choice questions where the raw answer may be a code (e.g., 0, 1) that lacks meaning on its own, use the associated **answer label** instead. \n\n\n **Important Notes:**\n\n - Do not make any conclusions, suggestions, interpretations, or provide additional comments. Only summarize the information provided in the form.\n\n **Style and Format Guidelines:**\n\n - Use **professional and informative language**, avoiding colloquialisms and overly technical terms.\n - Ensure the summary is **clear**, **concise**, and **easy to read**.\n\n **Language:**\n\n - It is critical to summarize in the language specified below. If Default or not specified, use the language of the form.\n\n **Specified Language:**\n\n {language}\n\n **Additional Instructions:**\n {additionalInstructions}\n\n ---\n\n **Content to Summarize:**\n\n {input}\n">, any>;
@@ -61,6 +61,9 @@ exports.systemPromptBulletPoints = prompts_1.ChatPromptTemplate.fromTemplate(`
61
61
 
62
62
  {language}
63
63
 
64
+ **Additional Instructions:**
65
+ {additionalInstructions}
66
+
64
67
  ---
65
68
 
66
69
  **Content to Summarize:**
@@ -114,6 +117,9 @@ exports.systemPromptTextParagraph = prompts_1.ChatPromptTemplate.fromTemplate(`
114
117
 
115
118
  {language}
116
119
 
120
+ **Additional Instructions:**
121
+ {additionalInstructions}
122
+
117
123
  ---
118
124
 
119
125
  **Content to Summarize:**
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/summarizeFormWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,wBAAwB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEvE,CAAC,CAAA;AAEW,QAAA,yBAAyB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDxE,CAAC,CAAA"}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/summarizeFormWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,wBAAwB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEvE,CAAC,CAAA;AAEW,QAAA,yBAAyB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDxE,CAAC,CAAA"}
@@ -15,15 +15,17 @@ import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
15
15
  * summaryFormat: "Bullet-points",
16
16
  * language: "English",
17
17
  * disclaimerMessage: "AI generated...",
18
+ * additionalInstructions: "Focus on medication details",
18
19
  * metadata: { ... }
19
20
  * })
20
21
  */
21
- export declare const summarizeFormWithLLM: ({ model, formData, summaryFormat, language, disclaimerMessage, metadata, callbacks, }: {
22
+ export declare const summarizeFormWithLLM: ({ model, formData, summaryFormat, language, disclaimerMessage, additionalInstructions, metadata, callbacks, }: {
22
23
  model: ChatOpenAI;
23
24
  formData: string;
24
25
  summaryFormat: string;
25
26
  language: string;
26
27
  disclaimerMessage: string;
28
+ additionalInstructions?: string;
27
29
  metadata: AIActionMetadata;
28
30
  callbacks?: BaseCallbackHandler[];
29
31
  }) => Promise<string>;
@@ -16,10 +16,11 @@ const prompt_1 = require("./prompt");
16
16
  * summaryFormat: "Bullet-points",
17
17
  * language: "English",
18
18
  * disclaimerMessage: "AI generated...",
19
+ * additionalInstructions: "Focus on medication details",
19
20
  * metadata: { ... }
20
21
  * })
21
22
  */
22
- const summarizeFormWithLLM = async ({ model, formData, summaryFormat, language, disclaimerMessage, metadata, callbacks, }) => {
23
+ const summarizeFormWithLLM = async ({ model, formData, summaryFormat, language, disclaimerMessage, additionalInstructions, metadata, callbacks, }) => {
23
24
  const systemPrompt = summaryFormat === 'Bullet-points' ? prompt_1.systemPromptBulletPoints :
24
25
  summaryFormat === 'Text paragraph' ? prompt_1.systemPromptTextParagraph :
25
26
  prompt_1.systemPromptBulletPoints; // Default to bullet points if unknown format
@@ -27,6 +28,7 @@ const summarizeFormWithLLM = async ({ model, formData, summaryFormat, language,
27
28
  language,
28
29
  input: formData,
29
30
  disclaimerMessage,
31
+ additionalInstructions: additionalInstructions !== null && additionalInstructions !== void 0 ? additionalInstructions : 'No additional instructions',
30
32
  });
31
33
  try {
32
34
  const result = await model.invoke(prompt, {
@@ -1 +1 @@
1
- {"version":3,"file":"summarizeFormWithLLM.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.ts"],"names":[],"mappings":";;;AAAA,qCAA8E;AAK9E;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,KAAK,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,SAAS,GASV,EAAmB,EAAE;IACpB,MAAM,YAAY,GAAG,aAAa,KAAK,eAAe,CAAC,CAAC,CAAC,iCAAwB,CAAC,CAAC;QAC/D,aAAa,KAAK,gBAAgB,CAAC,CAAC,CAAC,kCAAyB,CAAC,CAAC;YAChE,iCAAwB,CAAA,CAAC,6CAA6C;IAE1F,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC;QACvC,QAAQ;QACR,KAAK,EAAE,QAAQ;QACf,iBAAiB;KAClB,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,EACN;YACE,QAAQ;YACR,OAAO,EAAE,qBAAqB;YAC9B,SAAS;SACV,CACF,CAAA;QAED,OAAO,MAAM,CAAC,OAAiB,CAAA;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACpD,CAAC;AACH,CAAC,CAAA;AAzCY,QAAA,oBAAoB,wBAyChC"}
1
+ {"version":3,"file":"summarizeFormWithLLM.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.ts"],"names":[],"mappings":";;;AAAA,qCAA8E;AAK9E;;;;;;;;;;;;;;;;;GAiBG;AACI,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACzC,KAAK,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,iBAAiB,EACjB,sBAAsB,EACtB,QAAQ,EACR,SAAS,GAUV,EAAmB,EAAE;IACpB,MAAM,YAAY,GAAG,aAAa,KAAK,eAAe,CAAC,CAAC,CAAC,iCAAwB,CAAC,CAAC;QAC/D,aAAa,KAAK,gBAAgB,CAAC,CAAC,CAAC,kCAAyB,CAAC,CAAC;YAChE,iCAAwB,CAAA,CAAC,6CAA6C;IAE1F,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC;QACvC,QAAQ;QACR,KAAK,EAAE,QAAQ;QACf,iBAAiB;QACjB,sBAAsB,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,4BAA4B;KAC/E,CAAC,CAAA;IAEF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,EACN;YACE,QAAQ;YACR,OAAO,EAAE,qBAAqB;YAC9B,SAAS;SACV,CACF,CAAA;QAED,OAAO,MAAM,CAAC,OAAiB,CAAA;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IACpD,CAAC;AACH,CAAC,CAAA;AA5CY,QAAA,oBAAoB,wBA4ChC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.208",
3
+ "version": "2.0.209",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {