@awell-health/awell-extensions 2.0.152 → 2.0.154
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js +33 -113
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/findAppointmentsByPrompt.js.map +1 -1
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.d.ts +2 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.js +15 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/getAppoitnmentCountByStatus.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.d.ts +14 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js +36 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/findAppointmentsByPromptWithLLM.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.d.ts +17 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.js +14 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/parser.js.map +1 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.d.ts +2 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js +24 -0
- package/dist/extensions/elation/actions/findAppointmentsByPrompt/lib/findAppointmentsByPromptWithLLM/prompt.js.map +1 -0
- package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.d.ts +1 -1
- package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js +32 -90
- package/dist/extensions/elation/actions/findFutureAppointment/findFutureAppointment.js.map +1 -1
- package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.d.ts +2 -0
- package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js +18 -0
- package/dist/extensions/elation/actions/findFutureAppointment/formatAppointments.js.map +1 -0
- package/dist/extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.d.ts +3 -0
- package/dist/extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.js +15 -0
- package/dist/extensions/elation/actions/findFutureAppointment/getFutureAppoitnments.js.map +1 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.d.ts +14 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js +29 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.js.map +1 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.d.ts +17 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js +16 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js.map +1 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.d.ts +2 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js +20 -0
- package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js.map +1 -0
- package/dist/extensions/elation/actions/index.d.ts +0 -210
- package/dist/extensions/elation/actions/updatePatientTags/config/types.d.ts +29 -0
- package/dist/extensions/elation/actions/updatePatientTags/config/types.js +21 -0
- package/dist/extensions/elation/actions/updatePatientTags/config/types.js.map +1 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.d.ts +13 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js +29 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js.map +1 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.d.ts +13 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.js +7 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.js.map +1 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.d.ts +2 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.js +22 -0
- package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/prompt.js.map +1 -0
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.d.ts +8 -0
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js +35 -77
- package/dist/extensions/elation/actions/updatePatientTags/updatePatientTags.js.map +1 -1
- package/dist/extensions/elation/actions/updatePatientTags/updateTags.d.ts +2 -0
- package/dist/extensions/elation/actions/updatePatientTags/updateTags.js +18 -0
- package/dist/extensions/elation/actions/updatePatientTags/updateTags.js.map +1 -0
- package/dist/extensions/elation/settings.d.ts +1 -10
- package/dist/extensions/elation/settings.js +0 -8
- package/dist/extensions/elation/settings.js.map +1 -1
- package/dist/extensions/shelly/actions/categorizeMessage/categorizeMessage.d.ts +10 -2
- package/dist/extensions/shelly/actions/categorizeMessage/categorizeMessage.js +32 -24
- package/dist/extensions/shelly/actions/categorizeMessage/categorizeMessage.js.map +1 -1
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.d.ts +22 -2
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.js +22 -7
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.js.map +1 -1
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.d.ts +20 -0
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.js +18 -0
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.js.map +1 -0
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.d.ts +13 -0
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.js +35 -0
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.js.map +1 -0
- package/dist/extensions/shelly/actions/generateMessage/generateMessage.d.ts +10 -2
- package/dist/extensions/shelly/actions/generateMessage/generateMessage.js +33 -25
- package/dist/extensions/shelly/actions/generateMessage/generateMessage.js.map +1 -1
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.d.ts +18 -2
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.js +23 -10
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.js.map +1 -1
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.d.ts +28 -0
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.js +17 -0
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.js.map +1 -0
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/prompt.d.ts +10 -0
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/prompt.js +121 -0
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/prompt.js.map +1 -0
- package/dist/extensions/shelly/actions/index.d.ts +7 -63
- package/dist/extensions/shelly/actions/medicationFromImage/medicationFromImage.d.ts +1 -2
- package/dist/extensions/shelly/actions/medicationFromImage/medicationFromImage.js.map +1 -1
- package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.d.ts +1 -2
- package/dist/extensions/shelly/actions/reviewMedicationExtraction/reviewMedicationExtraction.js.map +1 -1
- package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/{constants.js → prompt.js} +1 -1
- package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/prompt.js.map +1 -0
- package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/summarizeCareFlowWithLLM.d.ts +22 -2
- package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/summarizeCareFlowWithLLM.js +30 -8
- package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/summarizeCareFlowWithLLM.js.map +1 -1
- package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlow.d.ts +1 -2
- package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlow.js +24 -21
- package/dist/extensions/shelly/actions/summarizeCareFlow/summarizeCareFlow.js.map +1 -1
- package/dist/extensions/shelly/actions/summarizeForm/summarizeForm.d.ts +10 -2
- package/dist/extensions/shelly/actions/summarizeForm/summarizeForm.js +42 -28
- package/dist/extensions/shelly/actions/summarizeForm/summarizeForm.js.map +1 -1
- package/dist/extensions/shelly/actions/summarizeFormsInStep/summarizeFormsInStep.d.ts +1 -2
- package/dist/extensions/shelly/actions/summarizeFormsInStep/summarizeFormsInStep.js +29 -26
- package/dist/extensions/shelly/actions/summarizeFormsInStep/summarizeFormsInStep.js.map +1 -1
- package/dist/extensions/shelly/index.js +2 -3
- package/dist/extensions/shelly/index.js.map +1 -1
- package/dist/extensions/shelly/lib/summarizeFormWithLLM/{constants.js → prompt.js} +1 -1
- package/dist/extensions/shelly/lib/summarizeFormWithLLM/prompt.js.map +1 -0
- package/dist/extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.d.ts +23 -2
- package/dist/extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.js +33 -9
- package/dist/extensions/shelly/lib/summarizeFormWithLLM/summarizeFormWithLLM.js.map +1 -1
- package/dist/extensions/shelly/lib/validatePayloadAndCreateSdk.d.ts +1 -5
- package/dist/extensions/shelly/lib/validatePayloadAndCreateSdk.js +5 -20
- package/dist/extensions/shelly/lib/validatePayloadAndCreateSdk.js.map +1 -1
- package/dist/src/lib/llm/openai/constants.d.ts +28 -0
- package/dist/src/lib/llm/openai/constants.js +32 -0
- package/dist/src/lib/llm/openai/constants.js.map +1 -0
- package/dist/src/lib/llm/openai/createOpenAIModel.d.ts +23 -0
- package/dist/src/lib/llm/openai/createOpenAIModel.js +89 -0
- package/dist/src/lib/llm/openai/createOpenAIModel.js.map +1 -0
- package/dist/src/lib/llm/openai/index.d.ts +3 -0
- package/dist/src/lib/llm/openai/index.js +20 -0
- package/dist/src/lib/llm/openai/index.js.map +1 -0
- package/dist/src/lib/llm/openai/types.d.ts +63 -0
- package/dist/src/lib/llm/openai/types.js +3 -0
- package/dist/src/lib/llm/openai/types.js.map +1 -0
- package/package.json +5 -4
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.d.ts +0 -24
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js +0 -33
- package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js.map +0 -1
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.d.ts +0 -24
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.js +0 -123
- package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.js.map +0 -1
- package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/constants.js.map +0 -1
- package/dist/extensions/shelly/lib/summarizeFormWithLLM/constants.js.map +0 -1
- package/dist/extensions/shelly/settings.d.ts +0 -17
- package/dist/extensions/shelly/settings.js +0 -17
- package/dist/extensions/shelly/settings.js.map +0 -1
- /package/dist/extensions/shelly/actions/summarizeCareFlow/lib/summarizeCareFlowWithLLM/{constants.d.ts → prompt.d.ts} +0 -0
- /package/dist/extensions/shelly/lib/summarizeFormWithLLM/{constants.d.ts → prompt.d.ts} +0 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createOpenAIModel = void 0;
|
4
|
+
const openai_1 = require("@langchain/openai");
|
5
|
+
const langsmith_1 = require("langsmith");
|
6
|
+
const tracer_langchain_1 = require("@langchain/core/tracers/tracer_langchain");
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const lodash_1 = require("lodash");
|
9
|
+
/**
|
10
|
+
* Creates a configured OpenAI model instance with proper tracing metadata
|
11
|
+
* Settings can optionally include openAiApiKey, otherwise falls back to environment configuration
|
12
|
+
*
|
13
|
+
* @param config - Configuration for model creation
|
14
|
+
* @returns Configured model, metadata for tracing, and optional callbacks for hiding data
|
15
|
+
* @throws Error if no API key is available in either settings or environment
|
16
|
+
*
|
17
|
+
* @example
|
18
|
+
* ```typescript
|
19
|
+
* const { model, metadata, callbacks } = await createOpenAIModel({
|
20
|
+
* settings,
|
21
|
+
* helpers,
|
22
|
+
* payload,
|
23
|
+
* modelType: OPENAI_MODELS.GPT4oMini,
|
24
|
+
* hideDataForTracing: true
|
25
|
+
* })
|
26
|
+
* ```
|
27
|
+
*/
|
28
|
+
const createOpenAIModel = async ({ settings = {}, helpers, payload, modelType = constants_1.OPENAI_MODELS.GPT4oMini, hideDataForTracing = false, }) => {
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
30
|
+
const apiKey = (_a = settings.openAiApiKey) !== null && _a !== void 0 ? _a : helpers.getOpenAIConfig().apiKey;
|
31
|
+
if ((0, lodash_1.isNil)(apiKey)) {
|
32
|
+
throw new Error('No OpenAI API key available in settings or environment configuration');
|
33
|
+
}
|
34
|
+
const model = new openai_1.ChatOpenAI({
|
35
|
+
modelName: constants_1.MODEL_VERSIONS[modelType],
|
36
|
+
openAIApiKey: apiKey,
|
37
|
+
...constants_1.OPENAI_CONFIG
|
38
|
+
});
|
39
|
+
let callbacks;
|
40
|
+
if (hideDataForTracing) {
|
41
|
+
// Utility function to mask outputs while preserving token usage
|
42
|
+
const maskOutputs = (outputs) => {
|
43
|
+
var _a;
|
44
|
+
const maskedGenerations = outputs.generations.map((generationArray) => generationArray.map((generation) => {
|
45
|
+
var _a, _b, _c, _d, _e, _f;
|
46
|
+
return ({
|
47
|
+
text: '[MASKED]',
|
48
|
+
message: {
|
49
|
+
lc: 1,
|
50
|
+
type: 'constructor',
|
51
|
+
id: ['langchain_core', 'messages', 'AIMessage'],
|
52
|
+
kwargs: {
|
53
|
+
content: '[MASKED]',
|
54
|
+
response_metadata: {
|
55
|
+
tokenUsage: (_c = (_b = (_a = generation.message) === null || _a === void 0 ? void 0 : _a.kwargs) === null || _b === void 0 ? void 0 : _b.response_metadata) === null || _c === void 0 ? void 0 : _c.tokenUsage,
|
56
|
+
finish_reason: (_f = (_e = (_d = generation.message) === null || _d === void 0 ? void 0 : _d.kwargs) === null || _e === void 0 ? void 0 : _e.response_metadata) === null || _f === void 0 ? void 0 : _f.finish_reason
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
});
|
61
|
+
}));
|
62
|
+
return {
|
63
|
+
generations: maskedGenerations,
|
64
|
+
llmOutput: {
|
65
|
+
tokenUsage: (_a = outputs.llmOutput) === null || _a === void 0 ? void 0 : _a.tokenUsage
|
66
|
+
}
|
67
|
+
};
|
68
|
+
};
|
69
|
+
const client = new langsmith_1.Client({
|
70
|
+
hideInputs: () => ({}),
|
71
|
+
hideOutputs: maskOutputs
|
72
|
+
});
|
73
|
+
callbacks = [new tracer_langchain_1.LangChainTracer({ client })];
|
74
|
+
}
|
75
|
+
return {
|
76
|
+
model,
|
77
|
+
metadata: {
|
78
|
+
activity_id: (_b = payload.activity.id) !== null && _b !== void 0 ? _b : '',
|
79
|
+
tenant_id: (_c = payload.pathway.tenant_id) !== null && _c !== void 0 ? _c : '',
|
80
|
+
care_flow_definition_id: (_d = payload.pathway.definition_id) !== null && _d !== void 0 ? _d : '',
|
81
|
+
care_flow_id: (_e = payload.pathway.id) !== null && _e !== void 0 ? _e : '',
|
82
|
+
org_slug: (_f = payload.pathway.org_slug) !== null && _f !== void 0 ? _f : '',
|
83
|
+
org_id: (_g = payload.pathway.org_id) !== null && _g !== void 0 ? _g : '',
|
84
|
+
},
|
85
|
+
callbacks // if not hideDataForTracing, callbacks is undefined, will use default callbacks
|
86
|
+
};
|
87
|
+
};
|
88
|
+
exports.createOpenAIModel = createOpenAIModel;
|
89
|
+
//# sourceMappingURL=createOpenAIModel.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createOpenAIModel.js","sourceRoot":"","sources":["../../../../../src/lib/llm/openai/createOpenAIModel.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAC9C,yCAAkC;AAClC,+EAA0E;AAE1E,2CAA0E;AAC1E,mCAA8B;AAE9B;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,QAAQ,GAAG,EAAE,EACb,OAAO,EACP,OAAO,EACP,SAAS,GAAG,yBAAa,CAAC,SAAS,EACnC,kBAAkB,GAAG,KAAK,GACiC,EAA8B,EAAE;;IAC3F,MAAM,MAAM,GAAG,MAAA,QAAQ,CAAC,YAAY,mCAAI,OAAO,CAAC,eAAe,EAAE,CAAC,MAAM,CAAA;IAExE,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,sEAAsE,CAAC,CAAA;IACzF,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,mBAAU,CAAC;QAC3B,SAAS,EAAE,0BAAc,CAAC,SAAS,CAAC;QACpC,YAAY,EAAE,MAAM;QACpB,GAAG,yBAAa;KACjB,CAAC,CAAA;IAEF,IAAI,SAAS,CAAC;IACd,IAAI,kBAAkB,EAAE,CAAC;QACvB,gEAAgE;QAChE,MAAM,WAAW,GAAG,CAAC,OAA4B,EAG/C,EAAE;;YACF,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,eAAsB,EAAE,EAAE,CAC3E,eAAe,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;;gBAAC,OAAA,CAAC;oBACnC,IAAI,EAAE,UAAU;oBAChB,OAAO,EAAE;wBACP,EAAE,EAAE,CAAC;wBACL,IAAI,EAAE,aAAa;wBACnB,EAAE,EAAE,CAAC,gBAAgB,EAAE,UAAU,EAAE,WAAW,CAAC;wBAC/C,MAAM,EAAE;4BACN,OAAO,EAAE,UAAU;4BACnB,iBAAiB,EAAE;gCACjB,UAAU,EAAE,MAAA,MAAA,MAAA,UAAU,CAAC,OAAO,0CAAE,MAAM,0CAAE,iBAAiB,0CAAE,UAAU;gCACrE,aAAa,EAAE,MAAA,MAAA,MAAA,UAAU,CAAC,OAAO,0CAAE,MAAM,0CAAE,iBAAiB,0CAAE,aAAa;6BAC5E;yBACF;qBACF;iBACF,CAAC,CAAA;aAAA,CAAC,CACJ,CAAC;YAEF,OAAO;gBACL,WAAW,EAAE,iBAAiB;gBAC9B,SAAS,EAAE;oBACT,UAAU,EAAE,MAAA,OAAO,CAAC,SAAS,0CAAE,UAAU;iBAC1C;aACF,CAAC;QACJ,CAAC,CAAC;QAEF,MAAM,MAAM,GAAG,IAAI,kBAAM,CAAC;YACxB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;YACtB,WAAW,EAAE,WAAW;SACzB,CAAC,CAAA;QACF,SAAS,GAAG,CAAC,IAAI,kCAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IAC/C,CAAC;IAED,OAAO;QACL,KAAK;QACL,QAAQ,EAAE;YACR,WAAW,EAAE,MAAA,OAAO,CAAC,QAAQ,CAAC,EAAE,mCAAI,EAAE;YACtC,SAAS,EAAE,MAAA,OAAO,CAAC,OAAO,CAAC,SAAS,mCAAI,EAAE;YAC1C,uBAAuB,EAAE,MAAA,OAAO,CAAC,OAAO,CAAC,aAAa,mCAAI,EAAE;YAC5D,YAAY,EAAE,MAAA,OAAO,CAAC,OAAO,CAAC,EAAE,mCAAI,EAAE;YACtC,QAAQ,EAAE,MAAA,OAAO,CAAC,OAAO,CAAC,QAAQ,mCAAI,EAAE;YACxC,MAAM,EAAE,MAAA,OAAO,CAAC,OAAO,CAAC,MAAM,mCAAI,EAAE;SACrC;QACD,SAAS,CAAC,gFAAgF;KAC3F,CAAA;AACH,CAAC,CAAA;AAvEY,QAAA,iBAAiB,qBAuE7B"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
+
if (k2 === undefined) k2 = k;
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
+
}
|
8
|
+
Object.defineProperty(o, k2, desc);
|
9
|
+
}) : (function(o, m, k, k2) {
|
10
|
+
if (k2 === undefined) k2 = k;
|
11
|
+
o[k2] = m[k];
|
12
|
+
}));
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
__exportStar(require("./types"), exports);
|
18
|
+
__exportStar(require("./constants"), exports);
|
19
|
+
__exportStar(require("./createOpenAIModel"), exports);
|
20
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/llm/openai/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,8CAA2B;AAC3B,sDAAmC"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import type { ChatOpenAI } from '@langchain/openai';
|
2
|
+
import type { OPENAI_MODELS } from './constants';
|
3
|
+
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
+
export type OpenAIModelType = typeof OPENAI_MODELS[keyof typeof OPENAI_MODELS];
|
5
|
+
interface MinimalPathway {
|
6
|
+
id?: string;
|
7
|
+
definition_id?: string;
|
8
|
+
tenant_id?: string;
|
9
|
+
org_slug?: string;
|
10
|
+
org_id?: string;
|
11
|
+
}
|
12
|
+
interface MinimalActivity {
|
13
|
+
id?: string;
|
14
|
+
}
|
15
|
+
interface RequiredPayloadProperties {
|
16
|
+
pathway: MinimalPathway;
|
17
|
+
activity: MinimalActivity;
|
18
|
+
}
|
19
|
+
export interface CreateOpenAIModelConfig {
|
20
|
+
/** Settings object that might contain an OpenAI API key */
|
21
|
+
settings: {
|
22
|
+
openAiApiKey?: string;
|
23
|
+
[key: string]: unknown;
|
24
|
+
};
|
25
|
+
/** Helpers object that can provide a default OpenAI config */
|
26
|
+
helpers: {
|
27
|
+
getOpenAIConfig: () => {
|
28
|
+
apiKey: string;
|
29
|
+
};
|
30
|
+
};
|
31
|
+
/** Payload containing the minimal required information */
|
32
|
+
payload: RequiredPayloadProperties & Record<string, any>;
|
33
|
+
/** Which OpenAI model to use */
|
34
|
+
modelType?: OpenAIModelType;
|
35
|
+
}
|
36
|
+
/**
|
37
|
+
* Standard metadata structure for AI actions tracking
|
38
|
+
* Used for LangSmith tracing and analytics
|
39
|
+
*/
|
40
|
+
export interface AIActionMetadata {
|
41
|
+
activity_id: string;
|
42
|
+
care_flow_definition_id: string;
|
43
|
+
care_flow_id: string;
|
44
|
+
tenant_id: string;
|
45
|
+
org_slug: string;
|
46
|
+
org_id: string;
|
47
|
+
[key: string]: unknown;
|
48
|
+
}
|
49
|
+
export interface OpenAIModelConfig {
|
50
|
+
/** Configured LangChain ChatOpenAI instance */
|
51
|
+
model: ChatOpenAI;
|
52
|
+
/** Tracing metadata for LangChain calls */
|
53
|
+
metadata: {
|
54
|
+
activity_id: string;
|
55
|
+
care_flow_definition_id: string;
|
56
|
+
care_flow_id: string;
|
57
|
+
tenant_id: string;
|
58
|
+
org_slug: string;
|
59
|
+
org_id: string;
|
60
|
+
};
|
61
|
+
callbacks?: BaseCallbackHandler[];
|
62
|
+
}
|
63
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/lib/llm/openai/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@awell-health/awell-extensions",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.154",
|
4
4
|
"packageManager": "yarn@4.5.3",
|
5
5
|
"main": "dist/src/index.js",
|
6
6
|
"repository": {
|
@@ -79,11 +79,11 @@
|
|
79
79
|
},
|
80
80
|
"dependencies": {
|
81
81
|
"@awell-health/awell-sdk": "^0.1.20",
|
82
|
-
"@awell-health/extensions-core": "1.0.
|
82
|
+
"@awell-health/extensions-core": "1.0.16",
|
83
83
|
"@awell-health/healthie-sdk": "^0.1.1",
|
84
84
|
"@dropbox/sign": "^1.8.0",
|
85
85
|
"@hubspot/api-client": "^11.2.0",
|
86
|
-
"@langchain/core": "^0.3.
|
86
|
+
"@langchain/core": "^0.3.33",
|
87
87
|
"@langchain/openai": "^0.3.0",
|
88
88
|
"@mailchimp/mailchimp_transactional": "^1.0.50",
|
89
89
|
"@medplum/core": "^3.1.4",
|
@@ -108,7 +108,8 @@
|
|
108
108
|
"jsdom": "^26.0.0",
|
109
109
|
"jsonpath": "^1.1.1",
|
110
110
|
"jsonwebtoken": "^9.0.2",
|
111
|
-
"langchain": "^0.3.
|
111
|
+
"langchain": "^0.3.12",
|
112
|
+
"langsmith": "^0.3.2",
|
112
113
|
"libphonenumber-js": "^1.10.26",
|
113
114
|
"lodash": "^4.17.21",
|
114
115
|
"mailgun.js": "^8.2.1",
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.d.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
-
import { StructuredOutputParser } from 'langchain/output_parsers';
|
3
|
-
import { z } from 'zod';
|
4
|
-
export declare const messageCategoriesSchema: z.ZodObject<{
|
5
|
-
matched_category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
6
|
-
match_explanation: z.ZodString;
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
8
|
-
matched_category: string;
|
9
|
-
match_explanation: string;
|
10
|
-
}, {
|
11
|
-
match_explanation: string;
|
12
|
-
matched_category?: string | undefined;
|
13
|
-
}>;
|
14
|
-
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
15
|
-
matched_category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
16
|
-
match_explanation: z.ZodString;
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
18
|
-
matched_category: string;
|
19
|
-
match_explanation: string;
|
20
|
-
}, {
|
21
|
-
match_explanation: string;
|
22
|
-
matched_category?: string | undefined;
|
23
|
-
}>>;
|
24
|
-
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an expert in categorizing different patient messages in a clinical context.\n Use your expertise to solve the message categorization task:\n 1. Categorize the input message into **one of the provided categories**: {categories}. If no category fits, return \"None\".\n 2. Provide a concise explanation of why the message belongs to the selected category.\n \n Important Instructions:\n - The message may be in multiple languages.\n - **Only** choose from the provided list of categories. **Do not create new categories** or alter the given ones.\n - If no category fits perfectly, or if the match is unclear, return \"None\" without guessing.\n - Carefully verify your selection before submitting your answer.\n \n Respond exclusively with a valid JSON object containing the following keys:\n - matched_category: The most suitable category. Must be from the following list: {categories} - None if no category fits. Absolutely refrain from creating new categories or altering existent one. Output should be one of the provided categories in the list.\n - match_explanation: A brief explanation supporting your decision.\n \n Input:\n {input}\n ">, any>;
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.systemPrompt = exports.parser = exports.messageCategoriesSchema = void 0;
|
4
|
-
const prompts_1 = require("@langchain/core/prompts");
|
5
|
-
const output_parsers_1 = require("langchain/output_parsers");
|
6
|
-
const zod_1 = require("zod");
|
7
|
-
// Define the Zod schema for the structured response
|
8
|
-
exports.messageCategoriesSchema = zod_1.z.object({
|
9
|
-
matched_category: zod_1.z.string().optional().default('None'), // The matched category
|
10
|
-
match_explanation: zod_1.z.string(), // One-sentence explanation of the match
|
11
|
-
});
|
12
|
-
// Create a structured output parser
|
13
|
-
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.messageCategoriesSchema);
|
14
|
-
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
15
|
-
You are an expert in categorizing different patient messages in a clinical context.
|
16
|
-
Use your expertise to solve the message categorization task:
|
17
|
-
1. Categorize the input message into **one of the provided categories**: {categories}. If no category fits, return "None".
|
18
|
-
2. Provide a concise explanation of why the message belongs to the selected category.
|
19
|
-
|
20
|
-
Important Instructions:
|
21
|
-
- The message may be in multiple languages.
|
22
|
-
- **Only** choose from the provided list of categories. **Do not create new categories** or alter the given ones.
|
23
|
-
- If no category fits perfectly, or if the match is unclear, return "None" without guessing.
|
24
|
-
- Carefully verify your selection before submitting your answer.
|
25
|
-
|
26
|
-
Respond exclusively with a valid JSON object containing the following keys:
|
27
|
-
- matched_category: The most suitable category. Must be from the following list: {categories} - None if no category fits. Absolutely refrain from creating new categories or altering existent one. Output should be one of the provided categories in the list.
|
28
|
-
- match_explanation: A brief explanation supporting your decision.
|
29
|
-
|
30
|
-
Input:
|
31
|
-
{input}
|
32
|
-
`);
|
33
|
-
//# sourceMappingURL=constants.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAC5D,6DAAiE;AACjE,6BAAuB;AAEvB,oDAAoD;AACvC,QAAA,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC9C,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,uBAAuB;IAChF,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,wCAAwC;CACxE,CAAC,CAAA;AAEF,oCAAoC;AACvB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,+BAAuB,CACxB,CAAA;AAEY,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;OAkBrD,CAAC,CAAA"}
|
package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.d.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
-
import { StructuredOutputParser } from 'langchain/output_parsers';
|
3
|
-
import { z } from 'zod';
|
4
|
-
export declare const generatedMessageCategoriesSchema: z.ZodObject<{
|
5
|
-
subject: z.ZodString;
|
6
|
-
message: z.ZodString;
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
8
|
-
message: string;
|
9
|
-
subject: string;
|
10
|
-
}, {
|
11
|
-
message: string;
|
12
|
-
subject: string;
|
13
|
-
}>;
|
14
|
-
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
15
|
-
subject: z.ZodString;
|
16
|
-
message: z.ZodString;
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
18
|
-
message: string;
|
19
|
-
subject: string;
|
20
|
-
}, {
|
21
|
-
message: string;
|
22
|
-
subject: string;
|
23
|
-
}>>;
|
24
|
-
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are an AI language model tasked with composing **personalized messages** for a **{stakeholder}** within a clinical workflow. Your goals are to:\n\n- Align the message with the **Communication Objective** to optimize for response, engagement, or desired action.\n- Use the **Personalization Inputs** to tailor the message appropriately.\n- Ensure clarity, appropriateness, and compliance with healthcare communication standards.\n- **Generate the message in the specified **Language**, ensuring accuracy and naturalness.**\n- **Keep the message brief and concise while still optimizing for the Communication Objective.**\n\n**Important Notes to Prevent Misuse:**\n\n- **Remain Focused on the Task:** You must **never change your goal** of composing appropriate messages as specified.\n- **Limit Your Output:** **Do not generate any content** other than what is instructed—specifically, the subject and message within the context of the communication.\n\nLet's proceed step by step:\n\n1. **Review the Inputs Carefully:**\n\n - **Communication Objective:** Understand the main purpose of the message. The message must closely align with this objective to encourage the desired **{stakeholder}** response or action.\n\n - **Personalization Inputs:** Use only the details provided here to personalize the message. **Do not infer or assume** any additional information about the recipient.\n\n - **Stakeholder:** Identify the intended recipient of the message (e.g., Patient, Clinician, Caregiver) and customize the message accordingly.\n\n - **Language:** **Generate the message in the specified language**, ensuring proper grammar and cultural appropriateness.\n\n2. **Message Structure:**\n\n - **Keep the message brief and concise**, while still effectively conveying the necessary information to optimize for the **Communication Objective**.\n\n - **Greeting:**\n - Start with an appropriate greeting.\n - Use the recipient's name if provided (e.g., \"Dear [Name],\", \"Hello [Name],\").\n - If no name is provided, use a generic greeting appropriate for the stakeholder (e.g., \"Hello,\").\n\n - **Body:**\n - Clearly and **concisely** convey the message in alignment with the **Communication Objective**.\n - Incorporate **Personalization Inputs** naturally to optimize engagement and encourage the desired response or action.\n - Refrain from phrases like \"We hope this message finds you well\" or similar pleasantries.\n\n - **Closing:**\n - End with a courteous sign-off suitable for the stakeholder (e.g., \"Sincerely,\", \"Best regards,\"). SIgn of as Your Care Team.\n - Include any necessary next steps or contact information, if relevant.\n\n3. **Content Guidelines:**\n\n - **Use Only Provided Information:**\n - Do not include any details not present in the inputs.\n - Avoid adding any assumptions or external information.\n\n - **Stay on Task:**\n - **Never change your goal** of composing appropriate messages.\n - **Do not generate any content** other than the subject and message as specified.\n - Do not include personal opinions, extraneous information, or any inappropriate content.\n\n - **Focus on the Objective:**\n - Ensure every part of the message contributes to achieving the **Communication Objective**.\n - Personalization should enhance the message's effectiveness in prompting the desired recipient action.\n\n4. **Style and Tone:**\n\n - Use a professional and appropriate tone for the stakeholder (e.g., friendly for patients, formal for clinicians).\n - Always write in a clear, respectful, and engaging manner to optimize the message's impact. Tailor the tone to the recipient's role and the context of the message.\n - **Always write from the perspective of the care organization using first person plural (e.g., \"We are...\"). Do not use first person singular (\"I am...\") or third person perspectives.**\n \n5. **Compliance and Sensitivity:**\n\n - Maintain confidentiality and comply with all relevant privacy regulations.\n - Be culturally sensitive and avoid any language that could be considered offensive or inappropriate.\n\n6. **Language:**\n\n - **Generate the subject and message in the specified **Language**, ensuring proper grammar, vocabulary, and cultural appropriateness.\n\n\n7. **Final Output:**\n\n - Respond exclusively with a valid JSON object containing the following keys - this is critical:\n\n - **subject**: A clear, professional, and concise subject line that aligns with the **Communication Objective** and is appropriate for clinical settings.\n\n - **message**: The complete, polished message formatted in **markdown**. Do not include any instructions or extra commentary. Ensure the message meets the following criteria:\n\n - **Brevity and Conciseness**: Keep the message brief and to the point while still effectively conveying the necessary information to achieve the **Communication Objective**.\n - **Clarity and Correctness**: Ensure the message is free of spelling and grammatical errors. Use clear and straightforward language.\n - **Truthfulness**: It is absolutely paramount that the information provided in the message is accurate and truthful. Do not include any misleading or false information that you did not get from the inputs. This is critical for maintaining trust and integrity in healthcare communication.\n - **Completeness**: The message must be complete and ready to send as is. It is critical to never use placeholders (e.g., \"[Contact Information]\", \"[Insert Date]\") or leave out essential information. If you want to urge recipient to contact the office and you do not have contact information keep it general and absolutely refrain from including any placeholders.\n\n\n\n**Inputs:**\n\n- **Communication Objective:**\n\n {communicationObjective}\n\n- **Personalization Inputs:**\n\n {personalizationInput}\n\n- **Stakeholder:**\n\n {stakeholder}\n\n- **Language:**\n\n {language}\n ">, any>;
|
package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.js
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.systemPrompt = exports.parser = exports.generatedMessageCategoriesSchema = void 0;
|
4
|
-
const prompts_1 = require("@langchain/core/prompts");
|
5
|
-
const output_parsers_1 = require("langchain/output_parsers");
|
6
|
-
const zod_1 = require("zod");
|
7
|
-
// Define the Zod schema for the structured response
|
8
|
-
exports.generatedMessageCategoriesSchema = zod_1.z.object({
|
9
|
-
subject: zod_1.z.string(), // generated subject
|
10
|
-
message: zod_1.z.string(), // generated message
|
11
|
-
});
|
12
|
-
// Create a structured output parser
|
13
|
-
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.generatedMessageCategoriesSchema);
|
14
|
-
// TODO: tune further
|
15
|
-
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
16
|
-
You are an AI language model tasked with composing **personalized messages** for a **{stakeholder}** within a clinical workflow. Your goals are to:
|
17
|
-
|
18
|
-
- Align the message with the **Communication Objective** to optimize for response, engagement, or desired action.
|
19
|
-
- Use the **Personalization Inputs** to tailor the message appropriately.
|
20
|
-
- Ensure clarity, appropriateness, and compliance with healthcare communication standards.
|
21
|
-
- **Generate the message in the specified **Language**, ensuring accuracy and naturalness.**
|
22
|
-
- **Keep the message brief and concise while still optimizing for the Communication Objective.**
|
23
|
-
|
24
|
-
**Important Notes to Prevent Misuse:**
|
25
|
-
|
26
|
-
- **Remain Focused on the Task:** You must **never change your goal** of composing appropriate messages as specified.
|
27
|
-
- **Limit Your Output:** **Do not generate any content** other than what is instructed—specifically, the subject and message within the context of the communication.
|
28
|
-
|
29
|
-
Let's proceed step by step:
|
30
|
-
|
31
|
-
1. **Review the Inputs Carefully:**
|
32
|
-
|
33
|
-
- **Communication Objective:** Understand the main purpose of the message. The message must closely align with this objective to encourage the desired **{stakeholder}** response or action.
|
34
|
-
|
35
|
-
- **Personalization Inputs:** Use only the details provided here to personalize the message. **Do not infer or assume** any additional information about the recipient.
|
36
|
-
|
37
|
-
- **Stakeholder:** Identify the intended recipient of the message (e.g., Patient, Clinician, Caregiver) and customize the message accordingly.
|
38
|
-
|
39
|
-
- **Language:** **Generate the message in the specified language**, ensuring proper grammar and cultural appropriateness.
|
40
|
-
|
41
|
-
2. **Message Structure:**
|
42
|
-
|
43
|
-
- **Keep the message brief and concise**, while still effectively conveying the necessary information to optimize for the **Communication Objective**.
|
44
|
-
|
45
|
-
- **Greeting:**
|
46
|
-
- Start with an appropriate greeting.
|
47
|
-
- Use the recipient's name if provided (e.g., "Dear [Name],", "Hello [Name],").
|
48
|
-
- If no name is provided, use a generic greeting appropriate for the stakeholder (e.g., "Hello,").
|
49
|
-
|
50
|
-
- **Body:**
|
51
|
-
- Clearly and **concisely** convey the message in alignment with the **Communication Objective**.
|
52
|
-
- Incorporate **Personalization Inputs** naturally to optimize engagement and encourage the desired response or action.
|
53
|
-
- Refrain from phrases like "We hope this message finds you well" or similar pleasantries.
|
54
|
-
|
55
|
-
- **Closing:**
|
56
|
-
- End with a courteous sign-off suitable for the stakeholder (e.g., "Sincerely,", "Best regards,"). SIgn of as Your Care Team.
|
57
|
-
- Include any necessary next steps or contact information, if relevant.
|
58
|
-
|
59
|
-
3. **Content Guidelines:**
|
60
|
-
|
61
|
-
- **Use Only Provided Information:**
|
62
|
-
- Do not include any details not present in the inputs.
|
63
|
-
- Avoid adding any assumptions or external information.
|
64
|
-
|
65
|
-
- **Stay on Task:**
|
66
|
-
- **Never change your goal** of composing appropriate messages.
|
67
|
-
- **Do not generate any content** other than the subject and message as specified.
|
68
|
-
- Do not include personal opinions, extraneous information, or any inappropriate content.
|
69
|
-
|
70
|
-
- **Focus on the Objective:**
|
71
|
-
- Ensure every part of the message contributes to achieving the **Communication Objective**.
|
72
|
-
- Personalization should enhance the message's effectiveness in prompting the desired recipient action.
|
73
|
-
|
74
|
-
4. **Style and Tone:**
|
75
|
-
|
76
|
-
- Use a professional and appropriate tone for the stakeholder (e.g., friendly for patients, formal for clinicians).
|
77
|
-
- Always write in a clear, respectful, and engaging manner to optimize the message's impact. Tailor the tone to the recipient's role and the context of the message.
|
78
|
-
- **Always write from the perspective of the care organization using first person plural (e.g., "We are..."). Do not use first person singular ("I am...") or third person perspectives.**
|
79
|
-
|
80
|
-
5. **Compliance and Sensitivity:**
|
81
|
-
|
82
|
-
- Maintain confidentiality and comply with all relevant privacy regulations.
|
83
|
-
- Be culturally sensitive and avoid any language that could be considered offensive or inappropriate.
|
84
|
-
|
85
|
-
6. **Language:**
|
86
|
-
|
87
|
-
- **Generate the subject and message in the specified **Language**, ensuring proper grammar, vocabulary, and cultural appropriateness.
|
88
|
-
|
89
|
-
|
90
|
-
7. **Final Output:**
|
91
|
-
|
92
|
-
- Respond exclusively with a valid JSON object containing the following keys - this is critical:
|
93
|
-
|
94
|
-
- **subject**: A clear, professional, and concise subject line that aligns with the **Communication Objective** and is appropriate for clinical settings.
|
95
|
-
|
96
|
-
- **message**: The complete, polished message formatted in **markdown**. Do not include any instructions or extra commentary. Ensure the message meets the following criteria:
|
97
|
-
|
98
|
-
- **Brevity and Conciseness**: Keep the message brief and to the point while still effectively conveying the necessary information to achieve the **Communication Objective**.
|
99
|
-
- **Clarity and Correctness**: Ensure the message is free of spelling and grammatical errors. Use clear and straightforward language.
|
100
|
-
- **Truthfulness**: It is absolutely paramount that the information provided in the message is accurate and truthful. Do not include any misleading or false information that you did not get from the inputs. This is critical for maintaining trust and integrity in healthcare communication.
|
101
|
-
- **Completeness**: The message must be complete and ready to send as is. It is critical to never use placeholders (e.g., "[Contact Information]", "[Insert Date]") or leave out essential information. If you want to urge recipient to contact the office and you do not have contact information keep it general and absolutely refrain from including any placeholders.
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
**Inputs:**
|
106
|
-
|
107
|
-
- **Communication Objective:**
|
108
|
-
|
109
|
-
{communicationObjective}
|
110
|
-
|
111
|
-
- **Personalization Inputs:**
|
112
|
-
|
113
|
-
{personalizationInput}
|
114
|
-
|
115
|
-
- **Stakeholder:**
|
116
|
-
|
117
|
-
{stakeholder}
|
118
|
-
|
119
|
-
- **Language:**
|
120
|
-
|
121
|
-
{language}
|
122
|
-
`);
|
123
|
-
//# sourceMappingURL=constants.js.map
|
package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/constants.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAC5D,6DAAiE;AACjE,6BAAuB;AAEvB,oDAAoD;AACvC,QAAA,gCAAgC,GAAG,OAAC,CAAC,MAAM,CAAC;IACvD,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,oBAAoB;IACzC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,EAAE,oBAAoB;CAC1C,CAAC,CAAA;AAEF,oCAAoC;AACvB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,wCAAgC,CACjC,CAAA;AAED,qBAAqB;AACR,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GzD,CAAC,CAAA"}
|
@@ -1 +0,0 @@
|
|
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"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../extensions/shelly/lib/summarizeFormWithLLM/constants.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,17 +0,0 @@
|
|
1
|
-
import { z } from 'zod';
|
2
|
-
export declare const settings: {
|
3
|
-
openAiApiKey: {
|
4
|
-
key: string;
|
5
|
-
label: string;
|
6
|
-
obfuscated: true;
|
7
|
-
required: true;
|
8
|
-
description: string;
|
9
|
-
};
|
10
|
-
};
|
11
|
-
export declare const SettingsValidationSchema: z.ZodObject<{
|
12
|
-
openAiApiKey: z.ZodString;
|
13
|
-
}, "strip", z.ZodTypeAny, {
|
14
|
-
openAiApiKey: string;
|
15
|
-
}, {
|
16
|
-
openAiApiKey: string;
|
17
|
-
}>;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.SettingsValidationSchema = exports.settings = void 0;
|
4
|
-
const zod_1 = require("zod");
|
5
|
-
exports.settings = {
|
6
|
-
openAiApiKey: {
|
7
|
-
key: 'openAiApiKey',
|
8
|
-
label: 'OpenAI API key ',
|
9
|
-
obfuscated: true,
|
10
|
-
required: true,
|
11
|
-
description: '',
|
12
|
-
},
|
13
|
-
};
|
14
|
-
exports.SettingsValidationSchema = zod_1.z.object({
|
15
|
-
openAiApiKey: zod_1.z.string().min(1),
|
16
|
-
});
|
17
|
-
//# sourceMappingURL=settings.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/shelly/settings.ts"],"names":[],"mappings":";;;AACA,6BAAwC;AAE3B,QAAA,QAAQ,GAAG;IACtB,YAAY,EAAE;QACZ,GAAG,EAAE,cAAc;QACnB,KAAK,EAAE,iBAAiB;QACxB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,EAAE;KAChB;CACgC,CAAA;AAEtB,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACoB,CAAC,CAAA"}
|
File without changes
|
File without changes
|