@awell-health/awell-extensions 2.0.29 → 2.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (18) hide show
  1. package/dist/extensions/shelly/actions/summarizeCareFlow/config/fields.js +1 -1
  2. package/dist/extensions/shelly/actions/summarizeCareFlow/config/fields.js.map +1 -1
  3. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.d.ts +1 -1
  4. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.js +26 -21
  5. package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.js.map +1 -1
  6. package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlowRealOpenAI.test.js +44 -2
  7. package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlowRealOpenAI.test.js.map +1 -1
  8. package/dist/extensions/shelly/actions/summarizeForm/config/fields.js +1 -1
  9. package/dist/extensions/shelly/actions/summarizeForm/config/fields.js.map +1 -1
  10. package/dist/extensions/shelly/actions/summarizeForm/lib/getResponseText/getResponseText.d.ts +3 -0
  11. package/dist/extensions/shelly/actions/summarizeForm/lib/getResponseText/getResponseText.js +7 -2
  12. package/dist/extensions/shelly/actions/summarizeForm/lib/getResponseText/getResponseText.js.map +1 -1
  13. package/dist/extensions/shelly/actions/summarizeForm/lib/summarizeFormWithLLM/constants.d.ts +1 -1
  14. package/dist/extensions/shelly/actions/summarizeForm/lib/summarizeFormWithLLM/constants.js +11 -5
  15. package/dist/extensions/shelly/actions/summarizeForm/lib/summarizeFormWithLLM/constants.js.map +1 -1
  16. package/dist/extensions/shelly/actions/summarizeForm/summarizeFormRealOpenAI.test.js +53 -0
  17. package/dist/extensions/shelly/actions/summarizeForm/summarizeFormRealOpenAI.test.js.map +1 -1
  18. package/package.json +1 -1
@@ -17,7 +17,7 @@ exports.fields = {
17
17
  stakeholder: {
18
18
  id: 'stakeholder',
19
19
  label: 'Stakeholder',
20
- description: 'Defaults to "Clinician"',
20
+ description: 'Indicates who the summarization is intended for. Defaults to "Clinician"',
21
21
  type: extensions_core_1.FieldType.STRING,
22
22
  required: false,
23
23
  },
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/summarizeCareFlow/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,sBAAsB,EAAE;QACtB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,2JAA2J;QAC7J,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,sBAAsB,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,WAAW,EAAE,aAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,GAAG,EAAU,EAAE;QACzB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,WAAW,CAAA;QAEvD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC;CAC6C,CAAC,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/summarizeCareFlow/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,sBAAsB,EAAE;QACtB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,2JAA2J;QAC7J,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,0EAA0E;QACvF,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,sBAAsB,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,WAAW,EAAE,aAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,GAAG,EAAU,EAAE;QACzB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,WAAW,CAAA;QAEvD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC;CAC6C,CAAC,CAAA"}
@@ -1,2 +1,2 @@
1
1
  import { ChatPromptTemplate } from '@langchain/core/prompts';
2
- export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant that provides summaries of activities performed in a care flow for different stakeholders in a healthcare setting.\n A care flow consists of tracks, steps, and actions that can be performed by a patient, a clinician, or the system itself. These actions may include patient tasks (e.g., form submissions), clinician interventions (e.g., messages sent), or system-triggered activities (e.g., API calls).\n \n Your job is to provide a clear, human-readable summary of these activities in chronological order, ensuring the summary is tailored for the specific stakeholder. Focus on activity names and descriptions, avoiding any mention of IDs or technical details.\n \n Instructions for summarizing:\n - Summarize the care flow activities in the order they were performed, maintaining the chronological sequence.\n - Ensure the summary is concise, clear, and relevant to the stakeholder's needs.\n - Focus on activity names, titles, and the nature of the actions (e.g., patient submitted a form, clinician responded to a message).\n - Do not include any IDs, internal codes, or technical jargononly human-readable information.\n - Tailor the summary to the specific stakeholder, emphasizing the information most relevant to their role.\n - Avoid making assumptions about actions not explicitly mentioned in the input.\n - Provide the summary as a set of bullet points unless otherwise specified in the instructions. Make it as concise as possible. \n \n Format:\n - Provide the summary as a set of bullet points unless otherwise specified in the instructions. Make it as concise as possible.\n - Format it as an easy-to-grasp timeline with all important values and information. \n - Always mention track, step, and action names if applicable unless otherwise specified in the additional instructions.\n - Never format it in markdown with bold, italic, etc., unless otherwise specified in the additional instructions.\n - Do not list usign words like next, finally, just list sumamries in bullet points, concisely.\n\n Additional Instructions:\n {additionalInstructions}\n\n Stakeholder:\n {stakeholder}\n\n Content to summarize:\n {input}\n ">, any>;
2
+ export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant that generates summaries of activities performed in a care flow for various stakeholders in a healthcare setting. Stakeholder might be a patient or somebody on their care team (clinician, doctor, nurse, ...)\n A care flow consists of tracks, steps, and actions completed by a patient, clinician, or the system. These actions may include tasks like patient form submissions, clinician interventions, or system-triggered events (e.g., API calls).\n\n Key details to remember:\n\n - The care flow, tracks, and steps must be activated in sequence, first care flow is activated, then track, then steps one by one with all actions in them. This means that step cannot be completed until all actions within that steps are completed.\n - Your goal is to provide a clear, human-readable summary of these activities in chronological order, tailored to the specific stakeholder. Focus on names and descriptions, omitting any technical details or IDs.\n\n Instructions for Summarizing:\n - Do a thorough examination of the input log of activities and reason about care flow, tracks, steps and actions.\n - Present activities in the order they occurred, following the chronological flow.\n - Keep the summary concise, clear, and relevant to the stakeholder's role.\n - Focus on activity names, titles, and what was performed (e.g., patient submitted a form, clinician sent a message).\n - Exclude IDs, internal codes, or technical languagestick to human-readable details.\n - Customize the summary for the stakeholder, highlighting information relevant to their perspective.\n - Do not make assumptions about activities, that are not explicitly provided in the input - this is critical.\n - Do not use terms like pathway or care pathway - use care flow instead.\n - It is critical to focus only on information provided in the input - absolutely refrain from making assumptions.\n\n Formatting Guidelines:\n - Reflect the care flow structure: tracks, steps, and actions (e.g., \"Patient submitted a form in Step X\").\n - Provide the summary as a clear, digestible paragraph unless instructed otherwise.\n - Always include track, step, and action names where applicable.\n - It is apsolutely critical to return proper markdown formatting, especially for new lines and paragraphs.\n\n\n Additional Instructions:\n {additionalInstructions}\n\n Stakeholder:\n {stakeholder}\n\n Content to summarize:\n {input}\n">, any>;
@@ -4,26 +4,31 @@ exports.systemPrompt = void 0;
4
4
  const prompts_1 = require("@langchain/core/prompts");
5
5
  // TODO: move prompt to LangSmith + further tune
6
6
  exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
7
- You are an assistant that provides summaries of activities performed in a care flow for different stakeholders in a healthcare setting.
8
- A care flow consists of tracks, steps, and actions that can be performed by a patient, a clinician, or the system itself. These actions may include patient tasks (e.g., form submissions), clinician interventions (e.g., messages sent), or system-triggered activities (e.g., API calls).
9
-
10
- Your job is to provide a clear, human-readable summary of these activities in chronological order, ensuring the summary is tailored for the specific stakeholder. Focus on activity names and descriptions, avoiding any mention of IDs or technical details.
11
-
12
- Instructions for summarizing:
13
- - Summarize the care flow activities in the order they were performed, maintaining the chronological sequence.
14
- - Ensure the summary is concise, clear, and relevant to the stakeholder's needs.
15
- - Focus on activity names, titles, and the nature of the actions (e.g., patient submitted a form, clinician responded to a message).
16
- - Do not include any IDs, internal codes, or technical jargon—only human-readable information.
17
- - Tailor the summary to the specific stakeholder, emphasizing the information most relevant to their role.
18
- - Avoid making assumptions about actions not explicitly mentioned in the input.
19
- - Provide the summary as a set of bullet points unless otherwise specified in the instructions. Make it as concise as possible.
20
-
21
- Format:
22
- - Provide the summary as a set of bullet points unless otherwise specified in the instructions. Make it as concise as possible.
23
- - Format it as an easy-to-grasp timeline with all important values and information.
24
- - Always mention track, step, and action names if applicable unless otherwise specified in the additional instructions.
25
- - Never format it in markdown with bold, italic, etc., unless otherwise specified in the additional instructions.
26
- - Do not list usign words like next, finally, just list sumamries in bullet points, concisely.
7
+ You are an assistant that generates summaries of activities performed in a care flow for various stakeholders in a healthcare setting. Stakeholder might be a patient or somebody on their care team (clinician, doctor, nurse, ...)
8
+ A care flow consists of tracks, steps, and actions completed by a patient, clinician, or the system. These actions may include tasks like patient form submissions, clinician interventions, or system-triggered events (e.g., API calls).
9
+
10
+ Key details to remember:
11
+
12
+ - The care flow, tracks, and steps must be activated in sequence, first care flow is activated, then track, then steps one by one with all actions in them. This means that step cannot be completed until all actions within that steps are completed.
13
+ - Your goal is to provide a clear, human-readable summary of these activities in chronological order, tailored to the specific stakeholder. Focus on names and descriptions, omitting any technical details or IDs.
14
+
15
+ Instructions for Summarizing:
16
+ - Do a thorough examination of the input log of activities and reason about care flow, tracks, steps and actions.
17
+ - Present activities in the order they occurred, following the chronological flow.
18
+ - Keep the summary concise, clear, and relevant to the stakeholder's role.
19
+ - Focus on activity names, titles, and what was performed (e.g., patient submitted a form, clinician sent a message).
20
+ - Exclude IDs, internal codes, or technical language—stick to human-readable details.
21
+ - Customize the summary for the stakeholder, highlighting information relevant to their perspective.
22
+ - Do not make assumptions about activities, that are not explicitly provided in the input - this is critical.
23
+ - Do not use terms like pathway or care pathway - use care flow instead.
24
+ - It is critical to focus only on information provided in the input - absolutely refrain from making assumptions.
25
+
26
+ Formatting Guidelines:
27
+ - Reflect the care flow structure: tracks, steps, and actions (e.g., "Patient submitted a form in Step X").
28
+ - Provide the summary as a clear, digestible paragraph unless instructed otherwise.
29
+ - Always include track, step, and action names where applicable.
30
+ - It is apsolutely critical to return proper markdown formatting, especially for new lines and paragraphs.
31
+
27
32
 
28
33
  Additional Instructions:
29
34
  {additionalInstructions}
@@ -33,5 +38,5 @@ exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
33
38
 
34
39
  Content to summarize:
35
40
  {input}
36
- `);
41
+ `);
37
42
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE5D,gDAAgD;AACnC,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BzD,CAAC,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE5D,gDAAgD;AACnC,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC3D,CAAC,CAAA"}
@@ -21,7 +21,7 @@ describe.skip('summarizeCareFlow - Real LLM calls with mocked Awell SDK', () =>
21
21
  },
22
22
  fields: {
23
23
  stakeholder: 'Clinician',
24
- additionalInstructions: 'Summarize activities focusing on important steps.',
24
+ additionalInstructions: '',
25
25
  },
26
26
  settings: {
27
27
  openAiApiKey: process.env.OPENAI_TEST_KEY, // Use your actual OpenAI API key here
@@ -49,7 +49,49 @@ describe.skip('summarizeCareFlow - Real LLM calls with mocked Awell SDK', () =>
49
49
  // Ensure that the model has actually been called (real call to ChatOpenAI)
50
50
  expect(onComplete).toHaveBeenCalledWith({
51
51
  data_points: {
52
- summary: expect.stringContaining('plugin'),
52
+ summary: expect.stringContaining('step'),
53
+ },
54
+ });
55
+ expect(onError).not.toHaveBeenCalled();
56
+ });
57
+ it('Should call the real model and focus on patient-completed actions', async () => {
58
+ // Set up payload
59
+ const payload = (0, tests_1.generateTestPayload)({
60
+ pathway: {
61
+ id: 'ai4rZaYEocjB',
62
+ definition_id: 'whatever',
63
+ },
64
+ fields: {
65
+ stakeholder: 'Clinician',
66
+ additionalInstructions: 'Focus only on actions completed by the patient.',
67
+ },
68
+ settings: {
69
+ openAiApiKey: process.env.OPENAI_TEST_KEY, // Use your actual OpenAI API key here
70
+ },
71
+ });
72
+ // Mock the Awell SDK to return care flow activities
73
+ const awellSdkMock = {
74
+ orchestration: {
75
+ query: jest.fn().mockResolvedValue({
76
+ pathwayActivities: pathwayActivitiesResponse_1.mockPathwayActivitiesResponse,
77
+ }),
78
+ },
79
+ };
80
+ helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
81
+ // Execute the action without mocking ChatOpenAI (real call)
82
+ await extensionAction.onEvent({
83
+ payload,
84
+ onComplete,
85
+ onError,
86
+ helpers,
87
+ });
88
+ // Assertions for the Awell SDK mock
89
+ expect(helpers.awellSdk).toHaveBeenCalled();
90
+ expect(awellSdkMock.orchestration.query).toHaveBeenCalledTimes(1);
91
+ // Ensure that the model has actually been called (real call to ChatOpenAI)
92
+ expect(onComplete).toHaveBeenCalledWith({
93
+ data_points: {
94
+ summary: expect.stringContaining('patient'),
53
95
  },
54
96
  });
55
97
  expect(onError).not.toHaveBeenCalled();
@@ -1 +1 @@
1
- {"version":3,"file":"summarizeCareFlowRealOpenAI.test.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/summarizeCareFlow/summarizeCareFlowRealOpenAI.test.ts"],"names":[],"mappings":";;AAAA,yBAAsB;AACtB,mEAA2D;AAC3D,mCAA6C;AAC7C,wBAAqC;AACrC,qFAAqF;AAErF,gCAAgC;AAChC,QAAQ,CAAC,IAAI,CAAC,0DAA0D,EAAE,GAAG,EAAE;IAC7E,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,GACjE,6BAAW,CAAC,UAAU,CAAC,oBAAiB,CAAC,CAAA;IAE3C,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,EAAE,CAAA;QACZ,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gEAAgE,EAAE,KAAK,IAAI,EAAE;QAC9E,iBAAiB;QACjB,MAAM,OAAO,GAAG,IAAA,2BAAmB,EAAC;YAClC,OAAO,EAAE;gBACP,EAAE,EAAE,cAAc;gBAClB,aAAa,EAAE,UAAU;aAC1B;YACD,MAAM,EAAE;gBACN,WAAW,EAAE,WAAW;gBACxB,sBAAsB,EACpB,mDAAmD;aACtD;YACD,QAAQ,EAAE;gBACR,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,sCAAsC;aAClF;SACF,CAAC,CAAA;QAEF,oDAAoD;QACpD,MAAM,YAAY,GAAG;YACnB,aAAa,EAAE;gBACb,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC;oBACjC,iBAAiB,EAAE,yDAA6B;iBACjD,CAAC;aACH;SACF,CAAA;QAED,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA;QAE5D,4DAA4D;QAC5D,MAAM,eAAe,CAAC,OAAO,CAAC;YAC5B,OAAO;YACP,UAAU;YACV,OAAO;YACP,OAAO;SACR,CAAC,CAAA;QAEF,oCAAoC;QACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAC3C,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QAEjE,2EAA2E;QAC3E,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;aAC3C;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"summarizeCareFlowRealOpenAI.test.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/summarizeCareFlow/summarizeCareFlowRealOpenAI.test.ts"],"names":[],"mappings":";;AAAA,yBAAsB;AACtB,mEAA2D;AAC3D,mCAA6C;AAC7C,wBAAqC;AACrC,qFAAqF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AAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC;aAC5C;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -17,7 +17,7 @@ exports.fields = {
17
17
  stakeholder: {
18
18
  id: 'stakeholder',
19
19
  label: 'Stakeholder',
20
- description: 'Defaults to "Clinician"',
20
+ description: 'Indicates who the summarization is intended for. Defaults to "Clinician"',
21
21
  type: extensions_core_1.FieldType.STRING,
22
22
  required: false,
23
23
  },
@@ -1 +1 @@
1
- {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/summarizeForm/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,sBAAsB,EAAE;QACtB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,0IAA0I;QAC5I,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,yBAAyB;QACtC,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,sBAAsB,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,WAAW,EAAE,aAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,GAAG,EAAU,EAAE;QACzB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,WAAW,CAAA;QAEvD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC;CAC6C,CAAC,CAAA"}
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../extensions/shelly/actions/summarizeForm/config/fields.ts"],"names":[],"mappings":";;;;;;AAAA,mEAAqE;AACrE,8CAAwC;AAE3B,QAAA,MAAM,GAAG;IACpB,sBAAsB,EAAE;QACtB,EAAE,EAAE,wBAAwB;QAC5B,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,0IAA0I;QAC5I,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;IACD,WAAW,EAAE;QACX,EAAE,EAAE,aAAa;QACjB,KAAK,EAAE,aAAa;QACpB,WAAW,EAAE,0EAA0E;QACvF,IAAI,EAAE,2BAAS,CAAC,MAAM;QACtB,QAAQ,EAAE,KAAK;KAChB;CAC8B,CAAA;AAEpB,QAAA,sBAAsB,GAAG,aAAC,CAAC,MAAM,CAAC;IAC7C,sBAAsB,EAAE,aAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACzD,WAAW,EAAE,aAAC;SACX,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,GAAG,EAAU,EAAE;QACzB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,WAAW,CAAA;QAEvD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC;CAC6C,CAAC,CAAA"}
@@ -3,6 +3,9 @@ export interface OmittedFormAnswer {
3
3
  questionId: string;
4
4
  reason: string;
5
5
  }
6
+ export declare const getFormTitle: (opts: {
7
+ formDefinition: Form;
8
+ }) => string;
6
9
  export declare const getResponseText: (opts: {
7
10
  formDefinition: Form;
8
11
  formResponse: FormResponse;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getResponseText = void 0;
3
+ exports.getResponseText = exports.getFormTitle = void 0;
4
4
  const getBooleanAnswer = (answer) => {
5
5
  if (answer === '0')
6
6
  return 'Answer: No';
@@ -64,6 +64,10 @@ const getQuestionAndAnswer = (questionDefinition, questionResponse) => {
64
64
  return addQuestionLabel(`Answer: ${String(questionResponse.value)}`);
65
65
  }
66
66
  };
67
+ const getFormTitle = (opts) => {
68
+ return opts.formDefinition.title;
69
+ };
70
+ exports.getFormTitle = getFormTitle;
67
71
  const getResponseText = (opts) => {
68
72
  const formAnswers = [];
69
73
  const omittedFormAnswers = [];
@@ -88,8 +92,9 @@ const getResponseText = (opts) => {
88
92
  });
89
93
  }
90
94
  });
95
+ const formTitle = (0, exports.getFormTitle)({ formDefinition: opts.formDefinition });
91
96
  return {
92
- result: formAnswers.join('\n\n----------------\n\n'),
97
+ result: `Form Title: ${formTitle}\n\n${formAnswers.join('\n\n----------------\n\n')}`,
93
98
  omittedFormAnswers,
94
99
  };
95
100
  };
@@ -1 +1 @@
1
- {"version":3,"file":"getResponseText.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/summarizeForm/lib/getResponseText/getResponseText.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,CACl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IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,0BAA0B,CAAC;QACpD,kBAAkB;KACnB,CAAA;AACH,CAAC,CAAA;AA3CY,QAAA,eAAe,mBA2C3B"}
1
+ {"version":3,"file":"getResponseText.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/summarizeForm/lib/getResponseText/getResponseText.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,GAAG,CAC/B,kBAA4B,EAC5B,gBAAwB,EAChB,EAAE;;IACV,MAAM,YAAY,G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ompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant that provides summaries of forms for different stakeholders in a clinical pathway setting.\n You will be given forms with answers, answer labels, and possible answer options if applicable, to summarize.\n Take into consideration that context of fomrms might weary - from general questions, basic contact information to more medically specific ones.\n Your job is to provide the summary of the context you have. Do not mention what is not present in the form. Do not make any assumtions - this is critical.\n Additionally, you will be given additional instructions on how to summarize the form directly from a stakeholder.\n \n Language:\n Your summary should be in the same language as the form unless otherwise specified in the additional instructions.\n\n Instructions for summarizing:\n - Focus on the specific use case and context you are summarizing.\n - It is extremely important to tailor the summary specifically for the stakeholder to maximize its usefulness to them.\n - Emphasize information that is most pertinent to the stakeholder's needs, including critical data, notable findings, and any insights particularly useful for them.\n - Provide a concise and clear summary that is brief yet comprehensive.\n - Aim for a length that conveys all key points without unnecessary details.\n - Do not list all questions and answers unless specified in the additional instructions.\n - Do not include titles or formatting like bold or italic.\n - Provide quick insights of key points in an easy-to-read format for the stakeholder. Format as buller points unless otherwise specified in the additional instructions.\n - Do not include anything that is not present in form (such as the assumption that the patient visited clinic).\n Do not put titles like Summary: , just provide the summary.\n\n Additional Instructions:\n {additionalInstructions}\n\n Stakeholder:\n {stakeholder}\n\n Content to summarize:\n {input}\n ">, any>;
2
+ export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an assistant that provides summaries of forms for different stakeholders in a clinical settings. \n Stakeholder can be a patient - in which case give a clear targetter summary for them. \n Stakeholder can also be clinician, doctor, nurse or anyone else on the patient's care team - in which case format your summary to help them quickly understand the context of patient's form responses.\n\n You will be given forms with answers, answer labels, and possible answer options if applicable, to summarize.\n Take into consideration that context of forms might weary - from general questions, basic contact information to more medically specific ones. Form title might sometimes reveal form context.\n Your job is to provide the summary of the context you have. Take into consideration form name.\n Do not mention what is not present in the form. Do not make any assumtions - this is critical.\n Additionally, you will be given additional instructions on how to summarize the form directly from a stakeholder.\n \n Language:\n Your summary should be in the same language as the form unless otherwise specified in the additional instructions.\n\n Instructions for summarizing:\n - Focus on the specific use case and context you are summarizing.\n - It is extremely important to tailor the summary specifically for the stakeholder to maximize its usefulness to them.\n - Emphasize information that is most pertinent to the stakeholder's needs, including critical data, notable findings, and any insights particularly useful for them.\n - Provide a concise and clear summary that is brief yet comprehensive.\n - Aim for a length that conveys all key points without unnecessary details.\n - Do not list all questions and answers unless specified in the additional instructions.\n - Do not include titles or formatting like bold or italic.\n - Provide quick insights of key points in an easy-to-read format for the stakeholder.\n - Do not include anything that is not present in form (such as the assumption that the patient visited clinic).\n - Do not add titles like Summary:, just provide the summary.\n - It is apsolutely critical to return proper markdown formatting, especially for new lines and paragraphs.\n\n\n Additional Instructions:\n {additionalInstructions}\n\n Stakeholder:\n {stakeholder}\n\n Content to summarize:\n {input}\n ">, any>;
@@ -4,10 +4,14 @@ exports.systemPrompt = void 0;
4
4
  const prompts_1 = require("@langchain/core/prompts");
5
5
  // TODO: move prompt to LangSmith + further tune
6
6
  exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
7
- You are an assistant that provides summaries of forms for different stakeholders in a clinical pathway setting.
7
+ You are an assistant that provides summaries of forms for different stakeholders in a clinical settings.
8
+ Stakeholder can be a patient - in which case give a clear targetter summary for them.
9
+ Stakeholder can also be clinician, doctor, nurse or anyone else on the patient's care team - in which case format your summary to help them quickly understand the context of patient's form responses.
10
+
8
11
  You will be given forms with answers, answer labels, and possible answer options if applicable, to summarize.
9
- Take into consideration that context of fomrms might weary - from general questions, basic contact information to more medically specific ones.
10
- Your job is to provide the summary of the context you have. Do not mention what is not present in the form. Do not make any assumtions - this is critical.
12
+ Take into consideration that context of forms might weary - from general questions, basic contact information to more medically specific ones. Form title might sometimes reveal form context.
13
+ Your job is to provide the summary of the context you have. Take into consideration form name.
14
+ Do not mention what is not present in the form. Do not make any assumtions - this is critical.
11
15
  Additionally, you will be given additional instructions on how to summarize the form directly from a stakeholder.
12
16
 
13
17
  Language:
@@ -21,9 +25,11 @@ exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
21
25
  - Aim for a length that conveys all key points without unnecessary details.
22
26
  - Do not list all questions and answers unless specified in the additional instructions.
23
27
  - Do not include titles or formatting like bold or italic.
24
- - Provide quick insights of key points in an easy-to-read format for the stakeholder. Format as buller points unless otherwise specified in the additional instructions.
28
+ - Provide quick insights of key points in an easy-to-read format for the stakeholder.
25
29
  - Do not include anything that is not present in form (such as the assumption that the patient visited clinic).
26
- Do not put titles like Summary: , just provide the summary.
30
+ - Do not add titles like Summary:, just provide the summary.
31
+ - It is apsolutely critical to return proper markdown formatting, especially for new lines and paragraphs.
32
+
27
33
 
28
34
  Additional Instructions:
29
35
  {additionalInstructions}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/summarizeForm/lib/summarizeFormWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE5D,gDAAgD;AACnC,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BzD,CAAC,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/summarizeForm/lib/summarizeFormWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE5D,gDAAgD;AACnC,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCzD,CAAC,CAAA"}
@@ -67,5 +67,58 @@ describe.skip('summarizeForm - Real LLM calls with mocked Awell SDK', () => {
67
67
  });
68
68
  expect(onError).not.toHaveBeenCalled();
69
69
  });
70
+ it('Should call the real model and use mocked form data without additional instructions', async () => {
71
+ // Set up payload
72
+ const payload = (0, tests_1.generateTestPayload)({
73
+ pathway: {
74
+ id: 'ai4rZaYEocjB',
75
+ definition_id: 'whatever',
76
+ },
77
+ activity: { id: 'X74HeDQ4N0gtdaSEuzF8s' },
78
+ patient: { id: 'whatever' },
79
+ fields: {
80
+ stakeholder: 'Clinician',
81
+ additionalInstructions: '',
82
+ },
83
+ settings: {
84
+ openAiApiKey: process.env.OPENAI_TEST_KEY, // Use your actual OpenAI API key here
85
+ },
86
+ });
87
+ // Mock the Awell SDK
88
+ const awellSdkMock = {
89
+ orchestration: {
90
+ mutation: jest.fn().mockResolvedValue({}),
91
+ query: jest
92
+ .fn()
93
+ .mockResolvedValueOnce({
94
+ pathwayActivities: pathwayActivitiesResponse_1.mockPathwayActivitiesResponse,
95
+ })
96
+ .mockResolvedValueOnce({
97
+ form: formDefinitionResponse_1.mockFormDefinitionResponse,
98
+ })
99
+ .mockResolvedValueOnce({
100
+ formResponse: formResponseResponse_1.mockFormResponseResponse,
101
+ }),
102
+ },
103
+ };
104
+ helpers.awellSdk = jest.fn().mockResolvedValue(awellSdkMock);
105
+ // Execute the action without mocking ChatOpenAI
106
+ await extensionAction.onEvent({
107
+ payload,
108
+ onComplete,
109
+ onError,
110
+ helpers,
111
+ });
112
+ // Assertions for the Awell SDK mock
113
+ expect(helpers.awellSdk).toHaveBeenCalled();
114
+ expect(awellSdkMock.orchestration.query).toHaveBeenCalledTimes(3);
115
+ // Ensure that the model has actually been called (real call to ChatOpenAI)
116
+ expect(onComplete).toHaveBeenCalledWith({
117
+ data_points: {
118
+ summary: expect.stringContaining('General Dummy Form'),
119
+ },
120
+ });
121
+ expect(onError).not.toHaveBeenCalled();
122
+ });
70
123
  });
71
124
  //# sourceMappingURL=summarizeFormRealOpenAI.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"summarizeFormRealOpenAI.test.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/summarizeForm/summarizeFormRealOpenAI.test.ts"],"names":[],"mappings":";;AAAA,yBAAsB;AACtB,mEAA2D;AAC3D,mCAA6C;AAC7C,wBAAiC;AACjC,qFAAqF;AACrF,+EAA+E;AAC/E,2EAA2E;AAE3E,+BAA+B;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C,CAAA;QAE5D,gDAAgD;QAChD,MAAM,eAAe,CAAC,OAAO,CAAC;YAC5B,OAAO;YACP,UAAU;YACV,OAAO;YACP,OAAO;SACR,CAAC,CAAA;QAEF,oCAAoC;QACpC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAC3C,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QAEjE,2EAA2E;QAC3E,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC;aAChD;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"summarizeFormRealOpenAI.test.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/summarizeForm/summarizeFormRealOpenAI.test.ts"],"names":[],"mappings":";;AAAA,yBAAsB;AACtB,mEAA2D;AAC3D,mCAA6C;AAC7C,wBAAiC;AACjC,qFAAqF;AACrF,+EAA+E;AAC/E,2EAA2E;AAE3E,+BAA+B;AAC/B,QAAQ,CAAC,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE;IACzE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,GACjE,6BAAW,CAAC,UAAU,CAAC,gBAAa,CAAC,CAAA;IAEvC,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,EAAE,CAAA;QACZ,IAAI,CAAC,aAAa,EAAE,CAAA;IACtB,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACnE,iBAAiB;QACjB,MAAM,OAAO,GAAG,IAAA,2BAAmB,E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C,OAAO,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAA;QAC3C,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QAEjE,2EAA2E;QAC3E,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC;YACtC,WAAW,EAAE;gBACX,OAAO,EAAE,MAAM,CAAC,gBAAgB,CAAC,oBAAoB,CAAC;aACvD;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.29",
3
+ "version": "2.0.30",
4
4
  "packageManager": "yarn@3.4.1",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {