@awell-health/awell-extensions 2.0.151 → 2.0.153
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/cerner/actions/createPatient/__testdata__/CreateFhirPatient.mock.d.ts +8 -0
- package/dist/extensions/cerner/actions/createPatient/__testdata__/CreateFhirPatient.mock.js +12 -0
- package/dist/extensions/cerner/actions/createPatient/__testdata__/CreateFhirPatient.mock.js.map +1 -0
- package/dist/extensions/cerner/actions/createPatient/config/datapoints.d.ts +6 -1
- package/dist/extensions/cerner/actions/createPatient/config/datapoints.js +6 -1
- package/dist/extensions/cerner/actions/createPatient/config/datapoints.js.map +1 -1
- package/dist/extensions/cerner/actions/createPatient/config/fields.d.ts +70 -2
- package/dist/extensions/cerner/actions/createPatient/config/fields.js +61 -2
- package/dist/extensions/cerner/actions/createPatient/config/fields.js.map +1 -1
- package/dist/extensions/cerner/actions/createPatient/createPatient.js +61 -1
- package/dist/extensions/cerner/actions/createPatient/createPatient.js.map +1 -1
- package/dist/extensions/cerner/actions/getPatient/__testdata__/PatientRead.mock.d.ts +37 -0
- package/dist/extensions/cerner/actions/getPatient/__testdata__/PatientRead.mock.js +55 -0
- package/dist/extensions/cerner/actions/getPatient/__testdata__/PatientRead.mock.js.map +1 -0
- package/dist/extensions/cerner/actions/getPatient/config/datapoints.d.ts +6 -1
- package/dist/extensions/cerner/actions/getPatient/config/datapoints.js +6 -1
- package/dist/extensions/cerner/actions/getPatient/config/datapoints.js.map +1 -1
- package/dist/extensions/cerner/actions/getPatient/config/fields.d.ts +17 -2
- package/dist/extensions/cerner/actions/getPatient/config/fields.js +13 -2
- package/dist/extensions/cerner/actions/getPatient/config/fields.js.map +1 -1
- package/dist/extensions/cerner/actions/getPatient/getPatient.js +33 -2
- package/dist/extensions/cerner/actions/getPatient/getPatient.js.map +1 -1
- package/dist/extensions/cerner/actions/index.d.ts +31 -4
- package/dist/extensions/cerner/actions/index.js +2 -6
- package/dist/extensions/cerner/actions/index.js.map +1 -1
- package/dist/extensions/cerner/index.js +1 -1
- package/dist/extensions/cerner/index.js.map +1 -1
- package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client-backup.d.ts +0 -0
- package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client-backup.js +172 -0
- package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client-backup.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client.d.ts +19 -0
- package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client.js +45 -0
- package/dist/extensions/cerner/lib/api/FhirR4/FhirR4client.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/cacheService.d.ts +11 -0
- package/dist/extensions/cerner/lib/api/FhirR4/cacheService.js +15 -0
- package/dist/extensions/cerner/lib/api/FhirR4/cacheService.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/index.d.ts +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/index.js +18 -0
- package/dist/extensions/cerner/lib/api/FhirR4/index.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/AppointmentRead.schema.d.ts +9 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/AppointmentRead.schema.js +6 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/AppointmentRead.schema.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/DocumentReferenceCreate.schema.d.ts +7 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/DocumentReferenceCreate.schema.js +3 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/DocumentReferenceCreate.schema.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientCreate.schema.d.ts +7 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientCreate.schema.js +3 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientCreate.schema.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientMatch.schema.d.ts +37 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientMatch.schema.js +3 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientMatch.schema.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientRead.schema.d.ts +9 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientRead.schema.js +6 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientRead.schema.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientSearch.schema.d.ts +8 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientSearch.schema.js +3 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/PatientSearch.schema.js.map +1 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/index.d.ts +6 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/index.js +23 -0
- package/dist/extensions/cerner/lib/api/FhirR4/schema/index.js.map +1 -0
- package/dist/extensions/cerner/lib/api/auth/constructCernerUrls.d.ts +4 -0
- package/dist/extensions/cerner/lib/api/auth/constructCernerUrls.js +11 -0
- package/dist/extensions/cerner/lib/api/auth/constructCernerUrls.js.map +1 -0
- package/dist/extensions/cerner/lib/api/auth/index.d.ts +1 -0
- package/dist/extensions/cerner/lib/api/auth/index.js +18 -0
- package/dist/extensions/cerner/lib/api/auth/index.js.map +1 -0
- package/dist/extensions/cerner/lib/validatePayloadAndCreateSdks.d.ts +18 -0
- package/dist/extensions/cerner/lib/validatePayloadAndCreateSdks.js +41 -0
- package/dist/extensions/cerner/lib/validatePayloadAndCreateSdks.js.map +1 -0
- package/dist/extensions/cerner/settings.d.ts +36 -2
- package/dist/extensions/cerner/settings.js +28 -2
- package/dist/extensions/cerner/settings.js.map +1 -1
- package/dist/extensions/dockHealth/lib/dock.types.d.ts +2 -2
- 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/elation/validation/referralOrder.zod.d.ts +17 -17
- package/dist/extensions/epic/actions/createClinicalNote/config/fields.js +1 -1
- package/dist/extensions/epic/actions/createClinicalNote/config/fields.js.map +1 -1
- package/dist/extensions/epic/actions/createClinicalNote/createClinicalNote.js +1 -1
- package/dist/extensions/epic/actions/createClinicalNote/createClinicalNote.js.map +1 -1
- package/dist/extensions/epic/actions/createPatient/config/fields.js +1 -1
- package/dist/extensions/epic/actions/createPatient/config/fields.js.map +1 -1
- package/dist/extensions/epic/actions/matchPatient/config/fields.js +1 -1
- package/dist/extensions/epic/actions/matchPatient/config/fields.js.map +1 -1
- package/dist/extensions/epic/lib/api/customFhirSchemas/DocumentReference/Status.schema.js.map +1 -0
- package/dist/extensions/epic/lib/api/customFhirSchemas/DocumentReference/Type.schema.js.map +1 -0
- package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/index.js +1 -1
- package/dist/extensions/epic/lib/api/customFhirSchemas/DocumentReference/index.js.map +1 -0
- package/dist/extensions/markdown.json +1 -1
- package/dist/extensions/medplum/actions/createServiceRequest/config/fields.js +4 -6
- package/dist/extensions/medplum/actions/createServiceRequest/config/fields.js.map +1 -1
- package/dist/extensions/medplum/actions/createTask/config/fields.js +4 -6
- package/dist/extensions/medplum/actions/createTask/config/fields.js.map +1 -1
- package/dist/extensions/medplum/fhir/schemas/resources/patient.schema.js +2 -2
- package/dist/extensions/medplum/fhir/schemas/resources/patient.schema.js.map +1 -1
- package/dist/extensions/medplum/fhir/schemas/resources/serviceRequest.schema.js +5 -5
- package/dist/extensions/medplum/fhir/schemas/resources/serviceRequest.schema.js.map +1 -1
- package/dist/extensions/medplum/fhir/schemas/resources/task.schema.js +4 -4
- package/dist/extensions/medplum/fhir/schemas/resources/task.schema.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/extensions/zendesk/v1/actions/createTask/config/fields.d.ts +2 -2
- package/dist/src/lib/fhir/schemas/Appointment/Status.schema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Appointment/index.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Patient/Gender.schema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Patient/index.js.map +1 -0
- package/dist/{extensions/medplum/fhir/schemas/atoms/IntentSchema.d.ts → src/lib/fhir/schemas/ServiceRequest/Intent.schema.d.ts} +0 -1
- package/dist/{extensions/medplum/fhir/schemas/atoms/IntentSchema.js → src/lib/fhir/schemas/ServiceRequest/Intent.schema.js} +2 -13
- package/dist/src/lib/fhir/schemas/ServiceRequest/Intent.schema.js.map +1 -0
- package/dist/{extensions/medplum/fhir/schemas/atoms/PrioritySchema.js → src/lib/fhir/schemas/ServiceRequest/Priority.schema.js} +1 -1
- package/dist/src/lib/fhir/schemas/ServiceRequest/Priority.schema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/ServiceRequest/Status.schema.d.ts +2 -0
- package/dist/src/lib/fhir/schemas/ServiceRequest/Status.schema.js +14 -0
- package/dist/src/lib/fhir/schemas/ServiceRequest/Status.schema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/ServiceRequest/index.d.ts +3 -0
- package/dist/src/lib/fhir/schemas/ServiceRequest/index.js +20 -0
- package/dist/src/lib/fhir/schemas/ServiceRequest/index.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Shared/PeriodSchema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Shared/index.d.ts +1 -0
- package/dist/src/lib/fhir/schemas/Shared/index.js +18 -0
- package/dist/src/lib/fhir/schemas/Shared/index.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Task/IntentSchema.d.ts +2 -0
- package/dist/src/lib/fhir/schemas/Task/IntentSchema.js +16 -0
- package/dist/src/lib/fhir/schemas/Task/IntentSchema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Task/Priority.schema.d.ts +2 -0
- package/dist/src/lib/fhir/schemas/Task/Priority.schema.js +6 -0
- package/dist/src/lib/fhir/schemas/Task/Priority.schema.js.map +1 -0
- package/dist/{extensions/medplum/fhir/schemas/atoms/StatusSchema.d.ts → src/lib/fhir/schemas/Task/Status.schema.d.ts} +0 -1
- package/dist/{extensions/medplum/fhir/schemas/atoms/StatusSchema.js → src/lib/fhir/schemas/Task/Status.schema.js} +2 -11
- package/dist/src/lib/fhir/schemas/Task/Status.schema.js.map +1 -0
- package/dist/src/lib/fhir/schemas/Task/index.d.ts +3 -0
- package/dist/src/lib/fhir/schemas/Task/index.js +20 -0
- package/dist/src/lib/fhir/schemas/Task/index.js.map +1 -0
- 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/cerner/actions/createClinicalNote/config/datapoints.d.ts +0 -1
- package/dist/extensions/cerner/actions/createClinicalNote/config/datapoints.js +0 -5
- package/dist/extensions/cerner/actions/createClinicalNote/config/datapoints.js.map +0 -1
- package/dist/extensions/cerner/actions/createClinicalNote/config/fields.d.ts +0 -3
- package/dist/extensions/cerner/actions/createClinicalNote/config/fields.js +0 -10
- package/dist/extensions/cerner/actions/createClinicalNote/config/fields.js.map +0 -1
- package/dist/extensions/cerner/actions/createClinicalNote/config/index.d.ts +0 -2
- package/dist/extensions/cerner/actions/createClinicalNote/config/index.js +0 -9
- package/dist/extensions/cerner/actions/createClinicalNote/config/index.js.map +0 -1
- package/dist/extensions/cerner/actions/createClinicalNote/createClinicalNote.d.ts +0 -4
- package/dist/extensions/cerner/actions/createClinicalNote/createClinicalNote.js +0 -18
- package/dist/extensions/cerner/actions/createClinicalNote/createClinicalNote.js.map +0 -1
- package/dist/extensions/cerner/actions/createClinicalNote/index.d.ts +0 -1
- package/dist/extensions/cerner/actions/createClinicalNote/index.js +0 -6
- package/dist/extensions/cerner/actions/createClinicalNote/index.js.map +0 -1
- package/dist/extensions/cerner/actions/getAppointment/config/datapoints.d.ts +0 -1
- package/dist/extensions/cerner/actions/getAppointment/config/datapoints.js +0 -5
- package/dist/extensions/cerner/actions/getAppointment/config/datapoints.js.map +0 -1
- package/dist/extensions/cerner/actions/getAppointment/config/fields.d.ts +0 -3
- package/dist/extensions/cerner/actions/getAppointment/config/fields.js +0 -10
- package/dist/extensions/cerner/actions/getAppointment/config/fields.js.map +0 -1
- package/dist/extensions/cerner/actions/getAppointment/config/index.d.ts +0 -2
- package/dist/extensions/cerner/actions/getAppointment/config/index.js +0 -9
- package/dist/extensions/cerner/actions/getAppointment/config/index.js.map +0 -1
- package/dist/extensions/cerner/actions/getAppointment/getAppointment.d.ts +0 -4
- package/dist/extensions/cerner/actions/getAppointment/getAppointment.js +0 -18
- package/dist/extensions/cerner/actions/getAppointment/getAppointment.js.map +0 -1
- package/dist/extensions/cerner/actions/getAppointment/index.d.ts +0 -1
- package/dist/extensions/cerner/actions/getAppointment/index.js +0 -6
- package/dist/extensions/cerner/actions/getAppointment/index.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/Appointment/Status.schema.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/Appointment/index.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/DocumentReference/Status.schema.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/DocumentReference/Type.schema.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/DocumentReference/index.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/Patient/Gender.schema.js.map +0 -1
- package/dist/extensions/epic/lib/api/schemas/Patient/index.js.map +0 -1
- package/dist/extensions/medplum/fhir/schemas/atoms/GenderSchema.d.ts +0 -2
- package/dist/extensions/medplum/fhir/schemas/atoms/GenderSchema.js +0 -6
- package/dist/extensions/medplum/fhir/schemas/atoms/GenderSchema.js.map +0 -1
- package/dist/extensions/medplum/fhir/schemas/atoms/IntentSchema.js.map +0 -1
- package/dist/extensions/medplum/fhir/schemas/atoms/PeriodSchema.js.map +0 -1
- package/dist/extensions/medplum/fhir/schemas/atoms/PrioritySchema.js.map +0 -1
- package/dist/extensions/medplum/fhir/schemas/atoms/StatusSchema.js.map +0 -1
- package/dist/extensions/medplum/fhir/schemas/atoms/index.d.ts +0 -5
- package/dist/extensions/medplum/fhir/schemas/atoms/index.js +0 -16
- package/dist/extensions/medplum/fhir/schemas/atoms/index.js.map +0 -1
- 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/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Status.schema.d.ts +0 -0
- package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Status.schema.js +0 -0
- package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Type.schema.d.ts +0 -0
- package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/Type.schema.js +0 -0
- package/dist/extensions/epic/lib/api/{schemas → customFhirSchemas}/DocumentReference/index.d.ts +1 -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
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/Status.schema.d.ts +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/Status.schema.js +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/index.d.ts +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Appointment/index.js +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/Gender.schema.d.ts +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/Gender.schema.js +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/index.d.ts +0 -0
- /package/dist/{extensions/epic/lib/api → src/lib/fhir}/schemas/Patient/index.js +0 -0
- /package/dist/{extensions/medplum/fhir/schemas/atoms/PrioritySchema.d.ts → src/lib/fhir/schemas/ServiceRequest/Priority.schema.d.ts} +0 -0
- /package/dist/{extensions/medplum/fhir/schemas/atoms → src/lib/fhir/schemas/Shared}/PeriodSchema.d.ts +0 -0
- /package/dist/{extensions/medplum/fhir/schemas/atoms → src/lib/fhir/schemas/Shared}/PeriodSchema.js +0 -0
@@ -1,4 +1,12 @@
|
|
1
1
|
import { type Action } from '@awell-health/extensions-core';
|
2
|
-
import { type settings } from '../../settings';
|
3
2
|
import { fields, dataPoints } from './config';
|
4
|
-
|
3
|
+
/**
|
4
|
+
* Awell Action: Message Categorization
|
5
|
+
*
|
6
|
+
* Takes a message and predefined categories as input, uses LLM to:
|
7
|
+
* 1. Determine the most appropriate category
|
8
|
+
* 2. Provide explanation for the categorization
|
9
|
+
*
|
10
|
+
* @returns category and HTML-formatted explanation
|
11
|
+
*/
|
12
|
+
export declare const categorizeMessage: Action<typeof fields, Record<string, never>, keyof typeof dataPoints>;
|
@@ -3,42 +3,50 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.categorizeMessage = void 0;
|
4
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
5
|
const categorizeMessageWithLLM_1 = require("./lib/categorizeMessageWithLLM");
|
6
|
-
const
|
6
|
+
const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
|
7
|
+
const constants_1 = require("../../../../src/lib/llm/openai/constants");
|
7
8
|
const config_1 = require("./config");
|
8
9
|
const utils_1 = require("../../../../src/utils");
|
10
|
+
/**
|
11
|
+
* Awell Action: Message Categorization
|
12
|
+
*
|
13
|
+
* Takes a message and predefined categories as input, uses LLM to:
|
14
|
+
* 1. Determine the most appropriate category
|
15
|
+
* 2. Provide explanation for the categorization
|
16
|
+
*
|
17
|
+
* @returns category and HTML-formatted explanation
|
18
|
+
*/
|
9
19
|
exports.categorizeMessage = {
|
10
20
|
key: 'categorizeMessage',
|
11
21
|
category: extensions_core_1.Category.WORKFLOW,
|
12
22
|
title: 'Categorize Message',
|
13
|
-
description: '
|
23
|
+
description: 'Categorizes messages into predefined categories with explanation.',
|
14
24
|
fields: config_1.fields,
|
15
25
|
previewable: false,
|
16
26
|
dataPoints: config_1.dataPoints,
|
17
27
|
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
18
|
-
|
19
|
-
|
28
|
+
// 1. Validate input fields
|
29
|
+
const { message, categories } = config_1.FieldsValidationSchema.parse(payload.fields);
|
30
|
+
// 2. Initialize OpenAI model with metadata
|
31
|
+
const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
|
32
|
+
settings: payload.settings,
|
33
|
+
helpers,
|
20
34
|
payload,
|
35
|
+
modelType: constants_1.OPENAI_MODELS.GPT4oMini,
|
36
|
+
});
|
37
|
+
// 3. Perform categorization
|
38
|
+
const result = await (0, categorizeMessageWithLLM_1.categorizeMessageWithLLM)({
|
39
|
+
model,
|
40
|
+
message,
|
41
|
+
categories,
|
42
|
+
metadata,
|
43
|
+
callbacks
|
44
|
+
});
|
45
|
+
// 4. Format and return results
|
46
|
+
const explanationHtml = await (0, utils_1.markdownToHtml)(result.explanation);
|
47
|
+
await onComplete({
|
48
|
+
data_points: { category: result.category, explanation: explanationHtml }
|
21
49
|
});
|
22
|
-
try {
|
23
|
-
const categorization_result = await (0, categorizeMessageWithLLM_1.categorizeMessageWithLLM)({
|
24
|
-
ChatModelGPT4oMini,
|
25
|
-
message,
|
26
|
-
categories,
|
27
|
-
});
|
28
|
-
const category = categorization_result.category;
|
29
|
-
const explanationHtml = await (0, utils_1.markdownToHtml)(categorization_result.explanation);
|
30
|
-
await onComplete({
|
31
|
-
data_points: {
|
32
|
-
category,
|
33
|
-
explanation: explanationHtml,
|
34
|
-
},
|
35
|
-
});
|
36
|
-
}
|
37
|
-
catch (error) {
|
38
|
-
console.error('Error categorizing message:', error);
|
39
|
-
// Catch in extention server
|
40
|
-
throw new Error('Error categorizing message');
|
41
|
-
}
|
42
50
|
},
|
43
51
|
};
|
44
52
|
//# sourceMappingURL=categorizeMessage.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"categorizeMessage.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/categorizeMessage/categorizeMessage.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,6EAAyE;AACzE,
|
1
|
+
{"version":3,"file":"categorizeMessage.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/categorizeMessage/categorizeMessage.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,6EAAyE;AACzE,wFAAoF;AACpF,wEAAwE;AACxE,qCAAqE;AACrE,iDAAsD;AAEtD;;;;;;;;GAQG;AACU,QAAA,iBAAiB,GAI1B;IACF,GAAG,EAAE,mBAAmB;IACxB,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EAAE,mEAAmE;IAChF,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IAEV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,2BAA2B;QAC3B,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,+BAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE5E,2CAA2C;QAC3C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC;YAC7D,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO;YACP,OAAO;YACP,SAAS,EAAE,yBAAa,CAAC,SAAS;SACnC,CAAC,CAAA;QAEF,4BAA4B;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAA,mDAAwB,EAAC;YAC5C,KAAK;YACL,OAAO;YACP,UAAU;YACV,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,+BAA+B;QAC/B,MAAM,eAAe,GAAG,MAAM,IAAA,sBAAc,EAAC,MAAM,CAAC,WAAW,CAAC,CAAA;QAChE,MAAM,UAAU,CAAC;YACf,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;SACzE,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,8 +1,28 @@
|
|
1
1
|
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
-
|
3
|
-
|
2
|
+
import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
|
3
|
+
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
+
/**
|
5
|
+
* Uses LLM to categorize a message into predefined categories.
|
6
|
+
* The function follows these steps:
|
7
|
+
* 1. Formats prompt with available categories
|
8
|
+
* 2. Runs LLM chain with structured output parsing
|
9
|
+
* 3. Validates and processes the result
|
10
|
+
*
|
11
|
+
* @example
|
12
|
+
* const result = await categorizeMessageWithLLM({
|
13
|
+
* model,
|
14
|
+
* message: "I need to schedule an appointment",
|
15
|
+
* categories: ["Scheduling", "Medical Question"],
|
16
|
+
* metadata: { ... }
|
17
|
+
* })
|
18
|
+
* // Returns: { category: "Scheduling", explanation: "..." }
|
19
|
+
*/
|
20
|
+
export declare const categorizeMessageWithLLM: ({ model, message, categories, metadata, callbacks, }: {
|
21
|
+
model: ChatOpenAI;
|
4
22
|
message: string;
|
5
23
|
categories: string[];
|
24
|
+
metadata: AIActionMetadata;
|
25
|
+
callbacks?: BaseCallbackHandler[];
|
6
26
|
}) => Promise<{
|
7
27
|
category: string;
|
8
28
|
explanation: string;
|
@@ -1,21 +1,36 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.categorizeMessageWithLLM = void 0;
|
4
|
-
const
|
5
|
-
|
6
|
-
|
4
|
+
const parser_1 = require("./parser");
|
5
|
+
const prompt_1 = require("./prompt");
|
6
|
+
/**
|
7
|
+
* Uses LLM to categorize a message into predefined categories.
|
8
|
+
* The function follows these steps:
|
9
|
+
* 1. Formats prompt with available categories
|
10
|
+
* 2. Runs LLM chain with structured output parsing
|
11
|
+
* 3. Validates and processes the result
|
12
|
+
*
|
13
|
+
* @example
|
14
|
+
* const result = await categorizeMessageWithLLM({
|
15
|
+
* model,
|
16
|
+
* message: "I need to schedule an appointment",
|
17
|
+
* categories: ["Scheduling", "Medical Question"],
|
18
|
+
* metadata: { ... }
|
19
|
+
* })
|
20
|
+
* // Returns: { category: "Scheduling", explanation: "..." }
|
21
|
+
*/
|
22
|
+
const categorizeMessageWithLLM = async ({ model, message, categories, metadata, callbacks, }) => {
|
7
23
|
var _a, _b;
|
8
|
-
const prompt = await
|
24
|
+
const prompt = await prompt_1.systemPrompt.format({
|
9
25
|
categories: categories.concat('None').join(', '),
|
10
26
|
input: message,
|
11
27
|
});
|
12
|
-
const chain =
|
28
|
+
const chain = model.pipe(parser_1.parser);
|
13
29
|
let result;
|
14
30
|
try {
|
15
|
-
result = await chain.invoke(prompt);
|
31
|
+
result = await chain.invoke(prompt, { metadata, runName: 'ShellyCategorizeMessage', callbacks });
|
16
32
|
}
|
17
33
|
catch (error) {
|
18
|
-
console.error('Error invoking the chain:', error);
|
19
34
|
throw new Error('Failed to categorize the message due to an internal error.');
|
20
35
|
}
|
21
36
|
const matchedCategory = (_a = result.matched_category) !== null && _a !== void 0 ? _a : 'None';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"categorizeMessageWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"categorizeMessageWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/categorizeMessageWithLLM.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,qCAAuC;AAKvC;;;;;;;;;;;;;;;GAeG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,KAAK,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,SAAS,GAOV,EAAsD,EAAE;;IACvD,MAAM,MAAM,GAAG,MAAM,qBAAY,CAAC,MAAM,CAAC;QACvC,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAChD,KAAK,EAAE,OAAO;KACf,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAEhC,IAAI,MAAM,CAAA;IACV,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CACzB,MAAM,EACN,EAAE,QAAQ,EAAE,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,CAC5D,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,4DAA4D,CAC7D,CAAA;IACH,CAAC;IAED,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,gBAAgB,mCAAI,MAAM,CAAA;IACzD,IAAI,QAAgB,CAAA;IACpB,IAAI,WAAW,GAAW,MAAA,MAAM,CAAC,iBAAiB,mCAAI,EAAE,CAAA;IAExD,yCAAyC;IACzC,IAAI,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QACzC,QAAQ,GAAG,eAAe,CAAA;IAC5B,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,MAAM,CAAA;QACjB,WAAW;YACT,oEAAoE,CAAA;IACxE,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;AAClC,CAAC,CAAA;AA9CY,QAAA,wBAAwB,4BA8CpC"}
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.d.ts
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
import { StructuredOutputParser } from 'langchain/output_parsers';
|
2
|
+
import { z } from 'zod';
|
3
|
+
/**
|
4
|
+
* Structured Output Parser
|
5
|
+
* Ensures LLM response follows the format:
|
6
|
+
* {
|
7
|
+
* matched_category: string // One of the provided categories or "None"
|
8
|
+
* match_explanation: string // Brief explanation of the categorization
|
9
|
+
* }
|
10
|
+
*/
|
11
|
+
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
12
|
+
matched_category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
13
|
+
match_explanation: z.ZodString;
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
15
|
+
matched_category: string;
|
16
|
+
match_explanation: string;
|
17
|
+
}, {
|
18
|
+
match_explanation: string;
|
19
|
+
matched_category?: string | undefined;
|
20
|
+
}>>;
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.js
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parser = void 0;
|
4
|
+
const output_parsers_1 = require("langchain/output_parsers");
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
/**
|
7
|
+
* Structured Output Parser
|
8
|
+
* Ensures LLM response follows the format:
|
9
|
+
* {
|
10
|
+
* matched_category: string // One of the provided categories or "None"
|
11
|
+
* match_explanation: string // Brief explanation of the categorization
|
12
|
+
* }
|
13
|
+
*/
|
14
|
+
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(zod_1.z.object({
|
15
|
+
matched_category: zod_1.z.string().optional().default('None'),
|
16
|
+
match_explanation: zod_1.z.string(),
|
17
|
+
}));
|
18
|
+
//# sourceMappingURL=parser.js.map
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6DAAiE;AACjE,6BAAuB;AAEvB;;;;;;;GAOG;AACU,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CACxD,OAAC,CAAC,MAAM,CAAC;IACP,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;IACvD,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE;CAC9B,CAAC,CACH,CAAA"}
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.d.ts
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
+
/**
|
3
|
+
* System Prompt Template
|
4
|
+
* Instructs the LLM to:
|
5
|
+
* 1. Choose a category from the provided list
|
6
|
+
* 2. Explain the choice
|
7
|
+
* 3. Return "None" if no category fits
|
8
|
+
*
|
9
|
+
* Variables:
|
10
|
+
* {categories} - Available categories, comma-separated
|
11
|
+
* {input} - Message to categorize
|
12
|
+
*/
|
13
|
+
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 from: {categories}\n - match_explanation: A brief explanation supporting your decision.\n\n Input:\n {input}\n">, any>;
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.systemPrompt = void 0;
|
4
|
+
const prompts_1 = require("@langchain/core/prompts");
|
5
|
+
/**
|
6
|
+
* System Prompt Template
|
7
|
+
* Instructs the LLM to:
|
8
|
+
* 1. Choose a category from the provided list
|
9
|
+
* 2. Explain the choice
|
10
|
+
* 3. Return "None" if no category fits
|
11
|
+
*
|
12
|
+
* Variables:
|
13
|
+
* {categories} - Available categories, comma-separated
|
14
|
+
* {input} - Message to categorize
|
15
|
+
*/
|
16
|
+
exports.systemPrompt = prompts_1.ChatPromptTemplate.fromTemplate(`
|
17
|
+
You are an expert in categorizing different patient messages in a clinical context.
|
18
|
+
Use your expertise to solve the message categorization task:
|
19
|
+
1. Categorize the input message into **one of the provided categories**: {categories}. If no category fits, return "None".
|
20
|
+
2. Provide a concise explanation of why the message belongs to the selected category.
|
21
|
+
|
22
|
+
Important Instructions:
|
23
|
+
- The message may be in multiple languages.
|
24
|
+
- **Only** choose from the provided list of categories. **Do not create new categories** or alter the given ones.
|
25
|
+
- If no category fits perfectly, or if the match is unclear, return "None" without guessing.
|
26
|
+
- Carefully verify your selection before submitting your answer.
|
27
|
+
|
28
|
+
Respond exclusively with a valid JSON object containing the following keys:
|
29
|
+
- matched_category: The most suitable category from: {categories}
|
30
|
+
- match_explanation: A brief explanation supporting your decision.
|
31
|
+
|
32
|
+
Input:
|
33
|
+
{input}
|
34
|
+
`);
|
35
|
+
//# sourceMappingURL=prompt.js.map
|
package/dist/extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/categorizeMessage/lib/categorizeMessageWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE5D;;;;;;;;;;GAUG;AACU,QAAA,YAAY,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;CAkB3D,CAAC,CAAA"}
|
@@ -1,4 +1,12 @@
|
|
1
1
|
import { type Action } from '@awell-health/extensions-core';
|
2
|
-
import { type settings } from '../../settings';
|
3
2
|
import { fields, dataPoints } from './config';
|
4
|
-
|
3
|
+
/**
|
4
|
+
* Awell Action: Message Generation
|
5
|
+
*
|
6
|
+
* Takes communication objective and personalization inputs, uses LLM to:
|
7
|
+
* 1. Generate a personalized message
|
8
|
+
* 2. Create appropriate subject line
|
9
|
+
*
|
10
|
+
* @returns subject and HTML-formatted message
|
11
|
+
*/
|
12
|
+
export declare const generateMessage: Action<typeof fields, Record<string, never>, keyof typeof dataPoints>;
|
@@ -3,9 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateMessage = void 0;
|
4
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
5
|
const generateMessageWithLLM_1 = require("./lib/generateMessageWithLLM");
|
6
|
-
const lib_1 = require("../../lib");
|
7
6
|
const config_1 = require("./config");
|
8
7
|
const utils_1 = require("../../../../src/utils");
|
8
|
+
const createOpenAIModel_1 = require("../../../../src/lib/llm/openai/createOpenAIModel");
|
9
|
+
const constants_1 = require("../../../../src/lib/llm/openai/constants");
|
10
|
+
/**
|
11
|
+
* Awell Action: Message Generation
|
12
|
+
*
|
13
|
+
* Takes communication objective and personalization inputs, uses LLM to:
|
14
|
+
* 1. Generate a personalized message
|
15
|
+
* 2. Create appropriate subject line
|
16
|
+
*
|
17
|
+
* @returns subject and HTML-formatted message
|
18
|
+
*/
|
9
19
|
exports.generateMessage = {
|
10
20
|
key: 'generateMessage',
|
11
21
|
category: extensions_core_1.Category.WORKFLOW,
|
@@ -15,32 +25,30 @@ exports.generateMessage = {
|
|
15
25
|
previewable: false,
|
16
26
|
dataPoints: config_1.dataPoints,
|
17
27
|
onEvent: async ({ payload, onComplete, onError, helpers }) => {
|
18
|
-
|
19
|
-
|
28
|
+
// 1. Validate input fields
|
29
|
+
const { communicationObjective, personalizationInput, stakeholder, language } = config_1.FieldsValidationSchema.parse(payload.fields);
|
30
|
+
// 2. Initialize OpenAI model with metadata
|
31
|
+
const { model, metadata, callbacks } = await (0, createOpenAIModel_1.createOpenAIModel)({
|
32
|
+
settings: payload.settings,
|
33
|
+
helpers,
|
20
34
|
payload,
|
35
|
+
modelType: constants_1.OPENAI_MODELS.GPT4o // Using GPT4 for high-quality message generation
|
36
|
+
});
|
37
|
+
// 3. Generate message
|
38
|
+
const { subject, message } = await (0, generateMessageWithLLM_1.generateMessageWithLLM)({
|
39
|
+
model,
|
40
|
+
communicationObjective,
|
41
|
+
personalizationInput,
|
42
|
+
stakeholder,
|
43
|
+
language,
|
44
|
+
metadata,
|
45
|
+
callbacks
|
46
|
+
});
|
47
|
+
// 4. Format and return results
|
48
|
+
const htmlMessage = await (0, utils_1.markdownToHtml)(message);
|
49
|
+
await onComplete({
|
50
|
+
data_points: { subject, message: htmlMessage }
|
21
51
|
});
|
22
|
-
try {
|
23
|
-
const generated_message = await (0, generateMessageWithLLM_1.generateMessageWithLLM)({
|
24
|
-
ChatModelGPT4o,
|
25
|
-
communicationObjective,
|
26
|
-
personalizationInput,
|
27
|
-
stakeholder,
|
28
|
-
language,
|
29
|
-
});
|
30
|
-
const { subject, message } = generated_message;
|
31
|
-
const htmlMessage = await (0, utils_1.markdownToHtml)(message);
|
32
|
-
await onComplete({
|
33
|
-
data_points: {
|
34
|
-
subject,
|
35
|
-
message: htmlMessage,
|
36
|
-
},
|
37
|
-
});
|
38
|
-
}
|
39
|
-
catch (error) {
|
40
|
-
console.error('Error generating message:', error);
|
41
|
-
// Catch in extention server
|
42
|
-
throw new Error('Error generating message');
|
43
|
-
}
|
44
52
|
},
|
45
53
|
};
|
46
54
|
//# sourceMappingURL=generateMessage.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generateMessage.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/generateMessage/generateMessage.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,yEAAqE;AACrE,
|
1
|
+
{"version":3,"file":"generateMessage.js","sourceRoot":"","sources":["../../../../../extensions/shelly/actions/generateMessage/generateMessage.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AACrE,yEAAqE;AACrE,qCAAqE;AACrE,iDAAsD;AACtD,wFAAoF;AACpF,wEAAwE;AAExE;;;;;;;;GAQG;AACU,QAAA,eAAe,GAIxB;IACF,GAAG,EAAE,iBAAiB;IACtB,QAAQ,EAAE,0BAAQ,CAAC,QAAQ;IAC3B,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,iCAAiC;IAC9C,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IAEV,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,EAAiB,EAAE;QAC1E,2BAA2B;QAC3B,MAAM,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,WAAW,EAAE,QAAQ,EAAE,GAC3E,+BAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE9C,2CAA2C;QAC3C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,qCAAiB,EAAC;YAC7D,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO;YACP,OAAO;YACP,SAAS,EAAE,yBAAa,CAAC,KAAK,CAAC,iDAAiD;SACjF,CAAC,CAAA;QAEF,sBAAsB;QACtB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,+CAAsB,EAAC;YACxD,KAAK;YACL,sBAAsB;YACtB,oBAAoB;YACpB,WAAW;YACX,QAAQ;YACR,QAAQ;YACR,SAAS;SACV,CAAC,CAAA;QAEF,+BAA+B;QAC/B,MAAM,WAAW,GAAG,MAAM,IAAA,sBAAc,EAAC,OAAO,CAAC,CAAA;QACjD,MAAM,UAAU,CAAC;YACf,WAAW,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE;SAC/C,CAAC,CAAA;IACJ,CAAC;CACF,CAAA"}
|
@@ -1,10 +1,26 @@
|
|
1
1
|
import { type ChatOpenAI } from '@langchain/openai';
|
2
|
-
|
3
|
-
|
2
|
+
import { type AIActionMetadata } from '../../../../../../src/lib/llm/openai/types';
|
3
|
+
import type { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
4
|
+
/**
|
5
|
+
* Generates a personalized message using LLM with retry logic
|
6
|
+
*
|
7
|
+
* @param model - OpenAI chat model
|
8
|
+
* @param communicationObjective - Purpose of the message
|
9
|
+
* @param personalizationInput - Details for message customization
|
10
|
+
* @param stakeholder - Target recipient (e.g., Patient, Clinician)
|
11
|
+
* @param language - Message language
|
12
|
+
* @param metadata - Tracking info for LangSmith
|
13
|
+
* @param callbacks - Optional callbacks for LangChain
|
14
|
+
* @returns Generated subject and message
|
15
|
+
*/
|
16
|
+
export declare const generateMessageWithLLM: ({ model, communicationObjective, personalizationInput, stakeholder, language, metadata, callbacks, }: {
|
17
|
+
model: ChatOpenAI;
|
4
18
|
communicationObjective: string;
|
5
19
|
personalizationInput: string;
|
6
20
|
stakeholder: string;
|
7
21
|
language: string;
|
22
|
+
metadata: AIActionMetadata;
|
23
|
+
callbacks?: BaseCallbackHandler[];
|
8
24
|
}) => Promise<{
|
9
25
|
subject: string;
|
10
26
|
message: string;
|
@@ -1,29 +1,43 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.generateMessageWithLLM = void 0;
|
4
|
-
const
|
5
|
-
const
|
4
|
+
const parser_1 = require("./parser");
|
5
|
+
const prompt_1 = require("./prompt");
|
6
|
+
/**
|
7
|
+
* Generates a personalized message using LLM with retry logic
|
8
|
+
*
|
9
|
+
* @param model - OpenAI chat model
|
10
|
+
* @param communicationObjective - Purpose of the message
|
11
|
+
* @param personalizationInput - Details for message customization
|
12
|
+
* @param stakeholder - Target recipient (e.g., Patient, Clinician)
|
13
|
+
* @param language - Message language
|
14
|
+
* @param metadata - Tracking info for LangSmith
|
15
|
+
* @param callbacks - Optional callbacks for LangChain
|
16
|
+
* @returns Generated subject and message
|
17
|
+
*/
|
18
|
+
const generateMessageWithLLM = async ({ model, communicationObjective, personalizationInput, stakeholder, language, metadata, callbacks, }) => {
|
6
19
|
var _a, _b;
|
7
|
-
|
20
|
+
// 1. Prepare prompt with inputs
|
21
|
+
const prompt = await prompt_1.systemPrompt.format({
|
8
22
|
communicationObjective,
|
9
23
|
personalizationInput,
|
10
24
|
stakeholder,
|
11
25
|
language,
|
12
26
|
});
|
13
|
-
|
27
|
+
// 2. Create chain with structured output
|
28
|
+
const structured_output_chain = model.pipe(parser_1.parser);
|
29
|
+
// 3. Run chain with retries
|
14
30
|
const MAX_RETRIES = 3;
|
15
31
|
let retries = 0;
|
16
32
|
let subject = '';
|
17
33
|
let message = '';
|
18
|
-
// TODO: do it with more grace eventually
|
19
34
|
while (retries < MAX_RETRIES) { // Sometimes the LLM returns a non-JSON response
|
20
35
|
try {
|
21
|
-
const generated_message = await structured_output_chain.invoke(prompt);
|
36
|
+
const generated_message = await structured_output_chain.invoke(prompt, { metadata, runName: 'ShellyGenerateMessage', callbacks });
|
22
37
|
subject = (_a = generated_message.subject) !== null && _a !== void 0 ? _a : '';
|
23
38
|
message = (_b = generated_message.message) !== null && _b !== void 0 ? _b : '';
|
24
|
-
// If subject or message are not directly available
|
39
|
+
// If subject or message are not directly available, try parsing AIMessageChunk
|
25
40
|
if (subject.trim() === '' || message.trim() === '') {
|
26
|
-
console.log('Attempting to parse AIMessageChunk...');
|
27
41
|
// Attempt to get content from AIMessageChunk
|
28
42
|
if ('content' in generated_message) {
|
29
43
|
try {
|
@@ -38,7 +52,7 @@ const generateMessageWithLLM = async ({ ChatModelGPT4o, communicationObjective,
|
|
38
52
|
}
|
39
53
|
}
|
40
54
|
catch (error) {
|
41
|
-
|
55
|
+
throw new Error('Error parsing message content');
|
42
56
|
}
|
43
57
|
}
|
44
58
|
}
|
@@ -50,7 +64,6 @@ const generateMessageWithLLM = async ({ ChatModelGPT4o, communicationObjective,
|
|
50
64
|
throw new Error('Failed to generate valid subject and message');
|
51
65
|
}
|
52
66
|
catch (error) {
|
53
|
-
console.error(`Attempt ${retries + 1} failed:`, error);
|
54
67
|
retries++;
|
55
68
|
if (retries >= MAX_RETRIES) {
|
56
69
|
throw new Error('Failed to generate the message after multiple attempts');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generateMessageWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"generateMessageWithLLM.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/generateMessageWithLLM.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,qCAAuC;AAKvC;;;;;;;;;;;GAWG;AACI,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,KAAK,EACL,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,SAAS,GASV,EAAiD,EAAE;;IAClD,gCAAgC;IAChC,MAAM,MAAM,GAAG,MAAM,qBAAY,CAAC,MAAM,CAAC;QACvC,sBAAsB;QACtB,oBAAoB;QACpB,WAAW;QACX,QAAQ;KACT,CAAC,CAAA;IAEF,yCAAyC;IACzC,MAAM,uBAAuB,GAAG,KAAK,CAAC,IAAI,CAAC,eAAM,CAAC,CAAA;IAElD,4BAA4B;IAC5B,MAAM,WAAW,GAAG,CAAC,CAAA;IACrB,IAAI,OAAO,GAAG,CAAC,CAAA;IACf,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,OAAO,GAAG,EAAE,CAAA;IAEhB,OAAO,OAAO,GAAG,WAAW,EAAE,CAAC,CAAC,gDAAgD;QAC9E,IAAI,CAAC;YACH,MAAM,iBAAiB,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAC5D,MAAM,EACN,EAAE,QAAQ,EAAE,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,CAC1D,CAAA;YACD,OAAO,GAAG,MAAA,iBAAiB,CAAC,OAAO,mCAAI,EAAE,CAAA;YACzC,OAAO,GAAG,MAAA,iBAAiB,CAAC,OAAO,mCAAI,EAAE,CAAA;YAEzC,+EAA+E;YAC/E,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACnD,6CAA6C;gBAC7C,IAAI,SAAS,IAAI,iBAAiB,EAAE,CAAC;oBACnC,IAAI,CAAC;wBACH,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAiB,CAAC,CAAA;wBACrE,IAAI,OAAO,aAAa,KAAK,QAAQ,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;4BAChE,IAAI,SAAS,IAAI,aAAa,IAAI,OAAO,aAAa,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gCAC5E,OAAO,GAAG,aAAa,CAAC,OAAO,CAAA;4BACjC,CAAC;4BACD,IAAI,SAAS,IAAI,aAAa,IAAI,OAAO,aAAa,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gCAC5E,OAAO,GAAG,aAAa,CAAC,OAAO,CAAA;4BACjC,CAAC;wBACH,CAAC;oBACH,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;oBAClD,CAAC;gBACH,CAAC;YACH,CAAC;YAED,sDAAsD;YACtD,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACnD,MAAK;YACP,CAAC;YAED,qEAAqE;YACrE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;QACjE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,EAAE,CAAA;YACT,IAAI,OAAO,IAAI,WAAW,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;YAC3E,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC7B,CAAC,CAAA;AA/EY,QAAA,sBAAsB,0BA+ElC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { StructuredOutputParser } from 'langchain/output_parsers';
|
2
|
+
import { z } from 'zod';
|
3
|
+
/**
|
4
|
+
* Message Generation Output Schema
|
5
|
+
* Defines the expected structure of the LLM response:
|
6
|
+
* - subject: Clear, professional subject line
|
7
|
+
* - message: Complete, markdown-formatted message body
|
8
|
+
*/
|
9
|
+
export declare const messageSchema: z.ZodObject<{
|
10
|
+
subject: z.ZodString;
|
11
|
+
message: z.ZodString;
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
13
|
+
message: string;
|
14
|
+
subject: string;
|
15
|
+
}, {
|
16
|
+
message: string;
|
17
|
+
subject: string;
|
18
|
+
}>;
|
19
|
+
export declare const parser: StructuredOutputParser<z.ZodObject<{
|
20
|
+
subject: z.ZodString;
|
21
|
+
message: z.ZodString;
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
23
|
+
message: string;
|
24
|
+
subject: string;
|
25
|
+
}, {
|
26
|
+
message: string;
|
27
|
+
subject: string;
|
28
|
+
}>>;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parser = exports.messageSchema = void 0;
|
4
|
+
const output_parsers_1 = require("langchain/output_parsers");
|
5
|
+
const zod_1 = require("zod");
|
6
|
+
/**
|
7
|
+
* Message Generation Output Schema
|
8
|
+
* Defines the expected structure of the LLM response:
|
9
|
+
* - subject: Clear, professional subject line
|
10
|
+
* - message: Complete, markdown-formatted message body
|
11
|
+
*/
|
12
|
+
exports.messageSchema = zod_1.z.object({
|
13
|
+
subject: zod_1.z.string(),
|
14
|
+
message: zod_1.z.string(),
|
15
|
+
});
|
16
|
+
exports.parser = output_parsers_1.StructuredOutputParser.fromZodSchema(exports.messageSchema);
|
17
|
+
//# sourceMappingURL=parser.js.map
|
package/dist/extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.js.map
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../extensions/shelly/actions/generateMessage/lib/generateMessageWithLLM/parser.ts"],"names":[],"mappings":";;;AAAA,6DAAiE;AACjE,6BAAuB;AAEvB;;;;;GAKG;AACU,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAA;AAEW,QAAA,MAAM,GAAG,uCAAsB,CAAC,aAAa,CAAC,qBAAa,CAAC,CAAA"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ChatPromptTemplate } from '@langchain/core/prompts';
|
2
|
+
/**
|
3
|
+
* System Prompt Template for message generation
|
4
|
+
* Instructs the LLM to:
|
5
|
+
* 1. Generate personalized messages for specific stakeholders
|
6
|
+
* 2. Follow healthcare communication standards
|
7
|
+
* 3. Output in specified language
|
8
|
+
* 4. Return structured subject and message
|
9
|
+
*/
|
10
|
+
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 \n Let's proceed step by step:\n \n 1. **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 \n 2. **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 \n 3. **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 \n 4. **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 \n 5. **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 \n 6. **Language:**\n \n - **Generate the subject and message in the specified **Language**, ensuring proper grammar, vocabulary, and cultural appropriateness.\n \n \n 7. **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>;
|