@awell-health/awell-extensions 2.0.152 → 2.0.153
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,14 @@
|
|
1
|
+
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
+
import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
|
3
|
+
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
+
import { type AppointmentFromAI } from './parser';
|
5
|
+
import { type AppointmentResponse } from '../../../../types';
|
6
|
+
interface FindAppointmentWithLLMProps {
|
7
|
+
model: ChatOpenAI;
|
8
|
+
appointments: AppointmentResponse[];
|
9
|
+
prompt: string;
|
10
|
+
metadata: AIActionMetadata;
|
11
|
+
callbacks?: BaseCallbackHandler[];
|
12
|
+
}
|
13
|
+
export declare const findAppointmentWithLLM: ({ model, appointments, prompt, metadata, callbacks, }: FindAppointmentWithLLMProps) => Promise<AppointmentFromAI>;
|
14
|
+
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.findAppointmentWithLLM = void 0;
|
4
|
+
const prompt_1 = require("./prompt");
|
5
|
+
const parser_1 = require("./parser");
|
6
|
+
const formatAppointments_1 = require("../../formatAppointments");
|
7
|
+
const findAppointmentWithLLM = async ({ model, appointments, prompt, metadata, callbacks, }) => {
|
8
|
+
const chain = model.pipe(parser_1.parser);
|
9
|
+
try {
|
10
|
+
const result = await chain.invoke(await prompt_1.systemPrompt.format({
|
11
|
+
format_instructions: parser_1.parser.getFormatInstructions(),
|
12
|
+
appointments: (0, formatAppointments_1.formatAppointments)(appointments),
|
13
|
+
prompt,
|
14
|
+
}), {
|
15
|
+
metadata,
|
16
|
+
runName: 'ElationFindAppointment',
|
17
|
+
callbacks
|
18
|
+
});
|
19
|
+
return {
|
20
|
+
appointmentId: result.appointmentId,
|
21
|
+
explanation: result.explanation
|
22
|
+
};
|
23
|
+
}
|
24
|
+
catch (error) {
|
25
|
+
throw new Error('Failed to find matching appointment.');
|
26
|
+
}
|
27
|
+
};
|
28
|
+
exports.findAppointmentWithLLM = findAppointmentWithLLM;
|
29
|
+
//# sourceMappingURL=findAppointmentWithLLM.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"findAppointmentWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/findAppointmentWithLLM.ts"],"names":[],"mappings":";;;AAGA,qCAAuC;AACvC,qCAAyD;AAEzD,iEAA6D;AAUtD,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,KAAK,EACL,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,GACmB,EAA8B,EAAE;IAC5D,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,MAAM,qBAAY,CAAC,MAAM,CAAC;YACxB,mBAAmB,EAAE,eAAM,CAAC,qBAAqB,EAAE;YACnD,YAAY,EAAE,IAAA,uCAAkB,EAAC,YAAY,CAAC;YAC9C,MAAM;SACP,CAAC,EACF;YACE,QAAQ;YACR,OAAO,EAAE,wBAAwB;YACjC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,aAAa;YACnC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;IACzD,CAAC;AACH,CAAC,CAAA;AA9BY,QAAA,sBAAsB,0BA8BlC"}
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.d.ts
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { StructuredOutputParser } from '@langchain/core/output_parsers';
|
3
|
+
export declare const AppointmentIdSchema: z.ZodNullable<z.ZodNumber>;
|
4
|
+
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
5
|
+
appointmentId: z.ZodNullable<z.ZodNumber>;
|
6
|
+
explanation: z.ZodString;
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
8
|
+
appointmentId: number | null;
|
9
|
+
explanation: string;
|
10
|
+
}, {
|
11
|
+
appointmentId: number | null;
|
12
|
+
explanation: string;
|
13
|
+
}>>;
|
14
|
+
export interface AppointmentFromAI {
|
15
|
+
appointmentId: number | null;
|
16
|
+
explanation: string;
|
17
|
+
}
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.js
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parser = exports.AppointmentIdSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const output_parsers_1 = require("@langchain/core/output_parsers");
|
6
|
+
exports.AppointmentIdSchema = zod_1.z.coerce
|
7
|
+
.number()
|
8
|
+
.nullable()
|
9
|
+
.describe('A single appointment');
|
10
|
+
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
|
11
|
+
appointmentId: exports.AppointmentIdSchema,
|
12
|
+
explanation: zod_1.z
|
13
|
+
.string()
|
14
|
+
.describe('A readable explanation of how the appointment was found and why'),
|
15
|
+
}));
|
16
|
+
//# sourceMappingURL=parser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM;KACxC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,sBAAsB,CAAC,CAAA;AAEtB,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,aAAa,EAAE,2BAAmB;IAClC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CACP,iEAAiE,CAClE;CACJ,CAAC,CACH,CAAA"}
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.d.ts
ADDED
@@ -0,0 +1,2 @@
|
|
1
|
+
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
+
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\n You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.\n \n Important instructions:\n - The appointment \"reason\" is the appointment type.\n - Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.\n - Think like a clinician. In other words, \"Rx\" should match a prescription appointment or follow-up related to a prescription.\n - If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.\n - If multiple appointments exist that match the instructions, you should return the first one.\n - Return your response in the following JSON format:\n {format_instructions}\n\n Input array: {appointments}\n Instruction: {prompt}\n">, any>;
|
package/dist/extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.systemPrompt = void 0;
|
4
|
+
const prompts_1 = require("@langchain/core/prompts");
|
5
|
+
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
6
|
+
You are a helpful medical assistant. You will receive a list (array) of future appointments for a single patient and instructions about which appointment to find. You're supposed to use the information in the list to find an appointment that matches, if one exists.
|
7
|
+
|
8
|
+
Important instructions:
|
9
|
+
- The appointment "reason" is the appointment type.
|
10
|
+
- Pay close attention to the instructions. They are intended to have been written by a clinician, for a clinician.
|
11
|
+
- Think like a clinician. In other words, "Rx" should match a prescription appointment or follow-up related to a prescription.
|
12
|
+
- If no appointment exists that obviously matches the instructions, that's a perfectly acceptable outcome.
|
13
|
+
- If multiple appointments exist that match the instructions, you should return the first one.
|
14
|
+
- Return your response in the following JSON format:
|
15
|
+
{format_instructions}
|
16
|
+
|
17
|
+
Input array: {appointments}
|
18
|
+
Instruction: {prompt}
|
19
|
+
`);
|
20
|
+
//# sourceMappingURL=prompt.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/findFutureAppointment/lib/findAppointmentWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;CAc3D,CAAC,CAAA"}
|
@@ -50,13 +50,6 @@ export declare const actions: {
|
|
50
50
|
description: string;
|
51
51
|
required: false;
|
52
52
|
};
|
53
|
-
openAiApiKey: {
|
54
|
-
key: string;
|
55
|
-
label: string;
|
56
|
-
obfuscated: true;
|
57
|
-
required: false;
|
58
|
-
description: string;
|
59
|
-
};
|
60
53
|
}, "status" | "firstName" | "lastName" | "email" | "dob" | "mobilePhone" | "preferredLanguage" | "sex" | "genderIdentity" | "middleName" | "notes" | "pronouns" | "ssn" | "race" | "ethnicity" | "primaryPhysicianId" | "caregiverPracticeId" | "mainPhone" | "actualName" | "legalGenderMarker" | "sexualOrientation" | "previousFirstName" | "previousLastName" | "preferredServiceLocationId" | "patientObject">;
|
61
54
|
createPatient: import("@awell-health/extensions-core").Action<{
|
62
55
|
firstName: {
|
@@ -243,13 +236,6 @@ export declare const actions: {
|
|
243
236
|
description: string;
|
244
237
|
required: false;
|
245
238
|
};
|
246
|
-
openAiApiKey: {
|
247
|
-
key: string;
|
248
|
-
label: string;
|
249
|
-
obfuscated: true;
|
250
|
-
required: false;
|
251
|
-
description: string;
|
252
|
-
};
|
253
239
|
}, "patientId">;
|
254
240
|
updatePatient: import("@awell-health/extensions-core").Action<{
|
255
241
|
patientId: {
|
@@ -434,13 +420,6 @@ export declare const actions: {
|
|
434
420
|
description: string;
|
435
421
|
required: false;
|
436
422
|
};
|
437
|
-
openAiApiKey: {
|
438
|
-
key: string;
|
439
|
-
label: string;
|
440
|
-
obfuscated: true;
|
441
|
-
required: false;
|
442
|
-
description: string;
|
443
|
-
};
|
444
423
|
}, never>;
|
445
424
|
createAppointment: import("@awell-health/extensions-core").Action<{
|
446
425
|
patientId: {
|
@@ -545,13 +524,6 @@ export declare const actions: {
|
|
545
524
|
description: string;
|
546
525
|
required: false;
|
547
526
|
};
|
548
|
-
openAiApiKey: {
|
549
|
-
key: string;
|
550
|
-
label: string;
|
551
|
-
obfuscated: true;
|
552
|
-
required: false;
|
553
|
-
description: string;
|
554
|
-
};
|
555
527
|
}, "appointmentId">;
|
556
528
|
getAppointment: import("@awell-health/extensions-core").Action<{
|
557
529
|
appointmentId: {
|
@@ -604,13 +576,6 @@ export declare const actions: {
|
|
604
576
|
description: string;
|
605
577
|
required: false;
|
606
578
|
};
|
607
|
-
openAiApiKey: {
|
608
|
-
key: string;
|
609
|
-
label: string;
|
610
|
-
obfuscated: true;
|
611
|
-
required: false;
|
612
|
-
description: string;
|
613
|
-
};
|
614
579
|
}, "practiceId" | "status" | "patientId" | "duration" | "reason" | "description" | "physicianId" | "appointment" | "scheduledDate" | "serviceLocationId" | "telehealthDetails">;
|
615
580
|
findAppointments: import("@awell-health/extensions-core").Action<{
|
616
581
|
patientId: {
|
@@ -696,13 +661,6 @@ export declare const actions: {
|
|
696
661
|
description: string;
|
697
662
|
required: false;
|
698
663
|
};
|
699
|
-
openAiApiKey: {
|
700
|
-
key: string;
|
701
|
-
label: string;
|
702
|
-
obfuscated: true;
|
703
|
-
required: false;
|
704
|
-
description: string;
|
705
|
-
};
|
706
664
|
}, "appointments" | "appointment_exists">;
|
707
665
|
getPharmacy: import("@awell-health/extensions-core").Action<{
|
708
666
|
ncpdpId: {
|
@@ -755,13 +713,6 @@ export declare const actions: {
|
|
755
713
|
description: string;
|
756
714
|
required: false;
|
757
715
|
};
|
758
|
-
openAiApiKey: {
|
759
|
-
key: string;
|
760
|
-
label: string;
|
761
|
-
obfuscated: true;
|
762
|
-
required: false;
|
763
|
-
description: string;
|
764
|
-
};
|
765
716
|
}, string>;
|
766
717
|
getPhysician: import("@awell-health/extensions-core").Action<{
|
767
718
|
physicianId: {
|
@@ -814,13 +765,6 @@ export declare const actions: {
|
|
814
765
|
description: string;
|
815
766
|
required: false;
|
816
767
|
};
|
817
|
-
openAiApiKey: {
|
818
|
-
key: string;
|
819
|
-
label: string;
|
820
|
-
obfuscated: true;
|
821
|
-
required: false;
|
822
|
-
description: string;
|
823
|
-
};
|
824
768
|
}, "caregiverPracticeId" | "physicianFirstName" | "physicianLastName" | "physicianCredentials" | "physicianEmail" | "physicianNPI" | "physicianUserId">;
|
825
769
|
findPhysician: import("@awell-health/extensions-core").Action<{
|
826
770
|
firstName: {
|
@@ -887,13 +831,6 @@ export declare const actions: {
|
|
887
831
|
description: string;
|
888
832
|
required: false;
|
889
833
|
};
|
890
|
-
openAiApiKey: {
|
891
|
-
key: string;
|
892
|
-
label: string;
|
893
|
-
obfuscated: true;
|
894
|
-
required: false;
|
895
|
-
description: string;
|
896
|
-
};
|
897
834
|
}, "physicianId" | "caregiverPracticeId" | "physicianFirstName" | "physicianLastName" | "physicianCredentials" | "physicianEmail" | "physicianNPI" | "physicianUserId">;
|
898
835
|
createNonVisitNote: import("@awell-health/extensions-core").Action<{
|
899
836
|
patientId: {
|
@@ -974,13 +911,6 @@ export declare const actions: {
|
|
974
911
|
description: string;
|
975
912
|
required: false;
|
976
913
|
};
|
977
|
-
openAiApiKey: {
|
978
|
-
key: string;
|
979
|
-
label: string;
|
980
|
-
obfuscated: true;
|
981
|
-
required: false;
|
982
|
-
description: string;
|
983
|
-
};
|
984
914
|
}, "nonVisitNoteId" | "nonVisitNoteBulletId">;
|
985
915
|
updateNonVisitNote: import("@awell-health/extensions-core").Action<{
|
986
916
|
nonVisitNoteId: {
|
@@ -1103,13 +1033,6 @@ export declare const actions: {
|
|
1103
1033
|
description: string;
|
1104
1034
|
required: false;
|
1105
1035
|
};
|
1106
|
-
openAiApiKey: {
|
1107
|
-
key: string;
|
1108
|
-
label: string;
|
1109
|
-
obfuscated: true;
|
1110
|
-
required: false;
|
1111
|
-
description: string;
|
1112
|
-
};
|
1113
1036
|
}, string>;
|
1114
1037
|
getNonVisitNote: import("@awell-health/extensions-core").Action<{
|
1115
1038
|
nonVisitNoteId: {
|
@@ -1162,13 +1085,6 @@ export declare const actions: {
|
|
1162
1085
|
description: string;
|
1163
1086
|
required: false;
|
1164
1087
|
};
|
1165
|
-
openAiApiKey: {
|
1166
|
-
key: string;
|
1167
|
-
label: string;
|
1168
|
-
obfuscated: true;
|
1169
|
-
required: false;
|
1170
|
-
description: string;
|
1171
|
-
};
|
1172
1088
|
}, "practiceId" | "patientId" | "text" | "authorId" | "tags" | "documentDate" | "chartDate">;
|
1173
1089
|
deleteNonVisitNote: import("@awell-health/extensions-core").Action<{
|
1174
1090
|
nonVisitNoteId: {
|
@@ -1221,13 +1137,6 @@ export declare const actions: {
|
|
1221
1137
|
description: string;
|
1222
1138
|
required: false;
|
1223
1139
|
};
|
1224
|
-
openAiApiKey: {
|
1225
|
-
key: string;
|
1226
|
-
label: string;
|
1227
|
-
obfuscated: true;
|
1228
|
-
required: false;
|
1229
|
-
description: string;
|
1230
|
-
};
|
1231
1140
|
}, string>;
|
1232
1141
|
createVisitNote: import("@awell-health/extensions-core").Action<{
|
1233
1142
|
patientId: {
|
@@ -1341,13 +1250,6 @@ export declare const actions: {
|
|
1341
1250
|
description: string;
|
1342
1251
|
required: false;
|
1343
1252
|
};
|
1344
|
-
openAiApiKey: {
|
1345
|
-
key: string;
|
1346
|
-
label: string;
|
1347
|
-
obfuscated: true;
|
1348
|
-
required: false;
|
1349
|
-
description: string;
|
1350
|
-
};
|
1351
1253
|
}, "visitNoteId">;
|
1352
1254
|
addVitals: import("@awell-health/extensions-core").Action<{
|
1353
1255
|
patientId: {
|
@@ -1596,13 +1498,6 @@ export declare const actions: {
|
|
1596
1498
|
description: string;
|
1597
1499
|
required: false;
|
1598
1500
|
};
|
1599
|
-
openAiApiKey: {
|
1600
|
-
key: string;
|
1601
|
-
label: string;
|
1602
|
-
obfuscated: true;
|
1603
|
-
required: false;
|
1604
|
-
description: string;
|
1605
|
-
};
|
1606
1501
|
}, "vitalsId">;
|
1607
1502
|
addHistory: import("@awell-health/extensions-core").Action<{
|
1608
1503
|
patientId: {
|
@@ -1675,13 +1570,6 @@ export declare const actions: {
|
|
1675
1570
|
description: string;
|
1676
1571
|
required: false;
|
1677
1572
|
};
|
1678
|
-
openAiApiKey: {
|
1679
|
-
key: string;
|
1680
|
-
label: string;
|
1681
|
-
obfuscated: true;
|
1682
|
-
required: false;
|
1683
|
-
description: string;
|
1684
|
-
};
|
1685
1573
|
}, string>;
|
1686
1574
|
addAllergy: import("@awell-health/extensions-core").Action<{
|
1687
1575
|
patientId: {
|
@@ -1762,13 +1650,6 @@ export declare const actions: {
|
|
1762
1650
|
description: string;
|
1763
1651
|
required: false;
|
1764
1652
|
};
|
1765
|
-
openAiApiKey: {
|
1766
|
-
key: string;
|
1767
|
-
label: string;
|
1768
|
-
obfuscated: true;
|
1769
|
-
required: false;
|
1770
|
-
description: string;
|
1771
|
-
};
|
1772
1653
|
}, "allergyId">;
|
1773
1654
|
postLetter: import("@awell-health/extensions-core").Action<{
|
1774
1655
|
patientId: {
|
@@ -1863,13 +1744,6 @@ export declare const actions: {
|
|
1863
1744
|
description: string;
|
1864
1745
|
required: false;
|
1865
1746
|
};
|
1866
|
-
openAiApiKey: {
|
1867
|
-
key: string;
|
1868
|
-
label: string;
|
1869
|
-
obfuscated: true;
|
1870
|
-
required: false;
|
1871
|
-
description: string;
|
1872
|
-
};
|
1873
1747
|
}, "letterId">;
|
1874
1748
|
createLabOrder: import("@awell-health/extensions-core").Action<{
|
1875
1749
|
patientId: {
|
@@ -1971,13 +1845,6 @@ export declare const actions: {
|
|
1971
1845
|
description: string;
|
1972
1846
|
required: false;
|
1973
1847
|
};
|
1974
|
-
openAiApiKey: {
|
1975
|
-
key: string;
|
1976
|
-
label: string;
|
1977
|
-
obfuscated: true;
|
1978
|
-
required: false;
|
1979
|
-
description: string;
|
1980
|
-
};
|
1981
1848
|
}, "labOrderId" | "printableLabOrderView">;
|
1982
1849
|
createMessageThread: import("@awell-health/extensions-core").Action<{
|
1983
1850
|
patientId: {
|
@@ -2079,13 +1946,6 @@ export declare const actions: {
|
|
2079
1946
|
description: string;
|
2080
1947
|
required: false;
|
2081
1948
|
};
|
2082
|
-
openAiApiKey: {
|
2083
|
-
key: string;
|
2084
|
-
label: string;
|
2085
|
-
obfuscated: true;
|
2086
|
-
required: false;
|
2087
|
-
description: string;
|
2088
|
-
};
|
2089
1949
|
}, "messageThreadId">;
|
2090
1950
|
getLetter: import("@awell-health/extensions-core").Action<{
|
2091
1951
|
letterId: {
|
@@ -2138,13 +1998,6 @@ export declare const actions: {
|
|
2138
1998
|
description: string;
|
2139
1999
|
required: false;
|
2140
2000
|
};
|
2141
|
-
openAiApiKey: {
|
2142
|
-
key: string;
|
2143
|
-
label: string;
|
2144
|
-
obfuscated: true;
|
2145
|
-
required: false;
|
2146
|
-
description: string;
|
2147
|
-
};
|
2148
2001
|
}, "body" | "signedBy">;
|
2149
2002
|
createReferralOrder: import("@awell-health/extensions-core").Action<{
|
2150
2003
|
patient: {
|
@@ -2245,13 +2098,6 @@ export declare const actions: {
|
|
2245
2098
|
description: string;
|
2246
2099
|
required: false;
|
2247
2100
|
};
|
2248
|
-
openAiApiKey: {
|
2249
|
-
key: string;
|
2250
|
-
label: string;
|
2251
|
-
obfuscated: true;
|
2252
|
-
required: false;
|
2253
|
-
description: string;
|
2254
|
-
};
|
2255
2101
|
}, "id">;
|
2256
2102
|
createCareGap: import("@awell-health/extensions-core").Action<{
|
2257
2103
|
quality_program: {
|
@@ -2352,13 +2198,6 @@ export declare const actions: {
|
|
2352
2198
|
description: string;
|
2353
2199
|
required: false;
|
2354
2200
|
};
|
2355
|
-
openAiApiKey: {
|
2356
|
-
key: string;
|
2357
|
-
label: string;
|
2358
|
-
obfuscated: true;
|
2359
|
-
required: false;
|
2360
|
-
description: string;
|
2361
|
-
};
|
2362
2201
|
}, "id">;
|
2363
2202
|
closeCareGap: import("@awell-health/extensions-core").Action<{
|
2364
2203
|
quality_program: {
|
@@ -2418,13 +2257,6 @@ export declare const actions: {
|
|
2418
2257
|
description: string;
|
2419
2258
|
required: false;
|
2420
2259
|
};
|
2421
|
-
openAiApiKey: {
|
2422
|
-
key: string;
|
2423
|
-
label: string;
|
2424
|
-
obfuscated: true;
|
2425
|
-
required: false;
|
2426
|
-
description: string;
|
2427
|
-
};
|
2428
2260
|
}, never>;
|
2429
2261
|
updatePatientTags: import("@awell-health/extensions-core").Action<{
|
2430
2262
|
patientId: {
|
@@ -2484,13 +2316,6 @@ export declare const actions: {
|
|
2484
2316
|
description: string;
|
2485
2317
|
required: false;
|
2486
2318
|
};
|
2487
|
-
openAiApiKey: {
|
2488
|
-
key: string;
|
2489
|
-
label: string;
|
2490
|
-
obfuscated: true;
|
2491
|
-
required: false;
|
2492
|
-
description: string;
|
2493
|
-
};
|
2494
2319
|
}, "updatedTags">;
|
2495
2320
|
getReferralOrder: import("@awell-health/extensions-core").Action<{
|
2496
2321
|
referralOrderId: {
|
@@ -2543,13 +2368,6 @@ export declare const actions: {
|
|
2543
2368
|
description: string;
|
2544
2369
|
required: false;
|
2545
2370
|
};
|
2546
|
-
openAiApiKey: {
|
2547
|
-
key: string;
|
2548
|
-
label: string;
|
2549
|
-
obfuscated: true;
|
2550
|
-
required: false;
|
2551
|
-
description: string;
|
2552
|
-
};
|
2553
2371
|
}, "patientId" | "practice" | "letterId" | "consultantName" | "diagnosisCodes" | "diagnosisLabels">;
|
2554
2372
|
findFutureAppointment: import("@awell-health/extensions-core").Action<{
|
2555
2373
|
patientId: {
|
@@ -2609,13 +2427,6 @@ export declare const actions: {
|
|
2609
2427
|
description: string;
|
2610
2428
|
required: false;
|
2611
2429
|
};
|
2612
|
-
openAiApiKey: {
|
2613
|
-
key: string;
|
2614
|
-
label: string;
|
2615
|
-
obfuscated: true;
|
2616
|
-
required: false;
|
2617
|
-
description: string;
|
2618
|
-
};
|
2619
2430
|
}, "appointment" | "explanation" | "appointmentExists">;
|
2620
2431
|
findAppointmentsByPrompt: import("@awell-health/extensions-core").Action<{
|
2621
2432
|
patientId: {
|
@@ -2675,13 +2486,6 @@ export declare const actions: {
|
|
2675
2486
|
description: string;
|
2676
2487
|
required: false;
|
2677
2488
|
};
|
2678
|
-
openAiApiKey: {
|
2679
|
-
key: string;
|
2680
|
-
label: string;
|
2681
|
-
obfuscated: true;
|
2682
|
-
required: false;
|
2683
|
-
description: string;
|
2684
|
-
};
|
2685
2489
|
}, "appointments" | "explanation" | "appointmentCountsByStatus">;
|
2686
2490
|
signNonVisitNote: import("@awell-health/extensions-core").Action<{
|
2687
2491
|
nonVisitNoteId: {
|
@@ -2741,13 +2545,6 @@ export declare const actions: {
|
|
2741
2545
|
description: string;
|
2742
2546
|
required: false;
|
2743
2547
|
};
|
2744
|
-
openAiApiKey: {
|
2745
|
-
key: string;
|
2746
|
-
label: string;
|
2747
|
-
obfuscated: true;
|
2748
|
-
required: false;
|
2749
|
-
description: string;
|
2750
|
-
};
|
2751
2548
|
}, never>;
|
2752
2549
|
updateReferralOrderResolution: import("@awell-health/extensions-core").Action<{
|
2753
2550
|
referralOrderId: {
|
@@ -2811,12 +2608,5 @@ export declare const actions: {
|
|
2811
2608
|
description: string;
|
2812
2609
|
required: false;
|
2813
2610
|
};
|
2814
|
-
openAiApiKey: {
|
2815
|
-
key: string;
|
2816
|
-
label: string;
|
2817
|
-
obfuscated: true;
|
2818
|
-
required: false;
|
2819
|
-
description: string;
|
2820
|
-
};
|
2821
2611
|
}, never>;
|
2822
2612
|
};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { StructuredOutputParser } from '@langchain/core/output_parsers';
|
3
|
+
export declare const SingleTagSchema: z.ZodString;
|
4
|
+
export declare const TagsSchema: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
5
|
+
export declare const TagsOutputSchema: z.ZodObject<{
|
6
|
+
updatedTags: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
7
|
+
explanation: z.ZodString;
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
9
|
+
updatedTags: string[];
|
10
|
+
explanation: string;
|
11
|
+
}, {
|
12
|
+
updatedTags: string[];
|
13
|
+
explanation: string;
|
14
|
+
}>;
|
15
|
+
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
16
|
+
updatedTags: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], string[]>;
|
17
|
+
explanation: z.ZodString;
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
19
|
+
updatedTags: string[];
|
20
|
+
explanation: string;
|
21
|
+
}, {
|
22
|
+
updatedTags: string[];
|
23
|
+
explanation: string;
|
24
|
+
}>>;
|
25
|
+
export type TagsOutput = z.infer<typeof TagsOutputSchema>;
|
26
|
+
export interface TagsFromAI {
|
27
|
+
validatedTags: string[];
|
28
|
+
explanation: string;
|
29
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parser = exports.TagsOutputSchema = exports.TagsSchema = exports.SingleTagSchema = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const output_parsers_1 = require("@langchain/core/output_parsers");
|
6
|
+
exports.SingleTagSchema = zod_1.z.string().max(100).describe('A single tag');
|
7
|
+
exports.TagsSchema = zod_1.z
|
8
|
+
.array(exports.SingleTagSchema)
|
9
|
+
.max(10)
|
10
|
+
.refine((items) => new Set(items).size === items.length, {
|
11
|
+
message: 'All items must be unique, no duplicate values allowed',
|
12
|
+
})
|
13
|
+
.describe('The updated array of tags');
|
14
|
+
exports.TagsOutputSchema = zod_1.z.object({
|
15
|
+
updatedTags: exports.TagsSchema,
|
16
|
+
explanation: zod_1.z
|
17
|
+
.string()
|
18
|
+
.describe('A readable explanation of the changes made to the tags and why'),
|
19
|
+
});
|
20
|
+
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.TagsOutputSchema);
|
21
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../extensions/elation/actions/updatePatientTags/config/types.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,mEAAuE;AAE1D,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAA;AAE9D,QAAA,UAAU,GAAG,OAAC;KACxB,KAAK,CAAC,uBAAe,CAAC;KACtB,GAAG,CAAC,EAAE,CAAC;KACP,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,EAAE;IACvD,OAAO,EAAE,uDAAuD;CACjE,CAAC;KACD,QAAQ,CAAC,2BAA2B,CAAC,CAAA;AAE3B,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,WAAW,EAAE,kBAAU;IACvB,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,QAAQ,CAAC,gEAAgE,CAAC;CAChF,CAAC,CAAA;AAEW,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CAAC,wBAAgB,CAAC,CAAA"}
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.d.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
+
import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
|
3
|
+
import { type TagsFromAI } from './parser';
|
4
|
+
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
5
|
+
interface GetTagsFromLLMProps {
|
6
|
+
model: ChatOpenAI;
|
7
|
+
existingTags: string[];
|
8
|
+
prompt: string;
|
9
|
+
metadata: AIActionMetadata;
|
10
|
+
callbacks?: BaseCallbackHandler[];
|
11
|
+
}
|
12
|
+
export declare const getTagsFromLLM: (props: GetTagsFromLLMProps) => Promise<TagsFromAI>;
|
13
|
+
export {};
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getTagsFromLLM = void 0;
|
4
|
+
const prompt_1 = require("./prompt");
|
5
|
+
const parser_1 = require("./parser");
|
6
|
+
const getTagsFromLLM = async (props) => {
|
7
|
+
const { model, existingTags, prompt, metadata, callbacks } = props;
|
8
|
+
try {
|
9
|
+
const chain = model.pipe(parser_1.parser);
|
10
|
+
const formattedPrompt = await prompt_1.systemPrompt.format({
|
11
|
+
existingTags: JSON.stringify(existingTags),
|
12
|
+
prompt
|
13
|
+
});
|
14
|
+
const result = await chain.invoke(formattedPrompt, {
|
15
|
+
metadata,
|
16
|
+
runName: 'ElationUpdatePatientTags',
|
17
|
+
callbacks
|
18
|
+
});
|
19
|
+
return {
|
20
|
+
validatedTags: result.updatedTags,
|
21
|
+
explanation: result.explanation
|
22
|
+
};
|
23
|
+
}
|
24
|
+
catch (error) {
|
25
|
+
throw new Error('Failed to update patient tags.');
|
26
|
+
}
|
27
|
+
};
|
28
|
+
exports.getTagsFromLLM = getTagsFromLLM;
|
29
|
+
//# sourceMappingURL=getTagsFromLLM.js.map
|
package/dist/extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getTagsFromLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/getTagsFromLLM.ts"],"names":[],"mappings":";;;AAEA,qCAAuC;AACvC,qCAAkD;AAW3C,MAAM,cAAc,GAAG,KAAK,EAAE,KAA0B,EAAuB,EAAE;IACtF,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAA;IAElE,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;QAChC,MAAM,eAAe,GAAG,MAAM,qBAAY,CAAC,MAAM,CAAC;YAChD,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;YAC1C,MAAM;SACP,CAAC,CAAA;QACF,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAC/B,eAAe,EACf;YACE,QAAQ;YACR,OAAO,EAAE,0BAA0B;YACnC,SAAS;SACV,CACF,CAAA;QAED,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,WAAW;YACjC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;IACnD,CAAC;AACH,CAAC,CAAA;AAzBY,QAAA,cAAc,kBAyB1B"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { StructuredOutputParser } from '@langchain/core/output_parsers';
|
2
|
+
import { type TagsFromAI } from '../../config/types';
|
3
|
+
export declare const parser: StructuredOutputParser<import("zod").ZodObject<{
|
4
|
+
updatedTags: import("zod").ZodEffects<import("zod").ZodArray<import("zod").ZodString, "many">, string[], string[]>;
|
5
|
+
explanation: import("zod").ZodString;
|
6
|
+
}, "strip", import("zod").ZodTypeAny, {
|
7
|
+
updatedTags: string[];
|
8
|
+
explanation: string;
|
9
|
+
}, {
|
10
|
+
updatedTags: string[];
|
11
|
+
explanation: string;
|
12
|
+
}>>;
|
13
|
+
export type { TagsFromAI };
|
@@ -0,0 +1,7 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parser = void 0;
|
4
|
+
const output_parsers_1 = require("@langchain/core/output_parsers");
|
5
|
+
const types_1 = require("../../config/types");
|
6
|
+
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(types_1.TagsOutputSchema);
|
7
|
+
//# sourceMappingURL=parser.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/elation/actions/updatePatientTags/lib/getTagsFromLLM/parser.ts"],"names":[],"mappings":";;;AAAA,mEAAuE;AACvE,8CAAsE;AAEzD,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CAAC,wBAAgB,CAAC,CAAA"}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
+
export declare const systemPrompt: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a clinical data manager. You will receive a list (array) of patient tags for a single patient and instructions about which tags to add, update, or remove. These tags are used to assign particular attributes to patients which can help with patient care, like grouping of patients, categorizing patients for reporting, or identifying patients for care.\n \n Important instructions:\n - The maximum number of tags is 10.\n - The max length of a single tag is 100 characters.\n - Ensure tags are unique.\n\n\n Input array: {existingTags}\n Instruction: {prompt}\n\n\nOutput a JSON object with two keys:\n1. updatedTags: The updated array of tags. If the input array is empty, the output should be an empty array.\n2. explanation: A readable explanation of the changes made to the tags and why\n">, any>;
|