@awell-health/awell-extensions 2.0.237 → 2.0.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,7 +45,7 @@ const fetchTestExamples = async () => {
45
45
  try {
46
46
  const testExamples = langsmith.listExamples({
47
47
  datasetName,
48
- splits: ['test'],
48
+ splits: ['test'], // change to ['validation'] to run on validation set
49
49
  });
50
50
  const examples = [];
51
51
  for await (const example of testExamples) {
@@ -135,6 +135,7 @@ const runEvaluation = async () => {
135
135
  evaluators: [appointmentsMatchEvaluator],
136
136
  experimentPrefix: 'FindAppointmentsWithLLM Evaluation',
137
137
  maxConcurrency: 16,
138
+ numRepetitions: 3,
138
139
  });
139
140
  const resultsArray = Array.isArray(results) ? results : [results];
140
141
  const experimentId = (_b = (_a = resultsArray[0]) === null || _a === void 0 ? void 0 : _a.run) === null || _b === void 0 ? void 0 : _b.run_id;
@@ -1 +1 @@
1
- {"version":3,"file":"FindAppointmentsWithLLM.evaluate.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/FindAppointmentsWithLLM.evaluate.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yCAAgD;AAChD,qDAA+C;AAC/C,wFAAoF;AACpF,uEAAmE;AACnE,wEAAwE;AAExE,mCAA8B;AAG9B,oDAA2B;AAC3B,gBAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,SAAS,GAAG,IAAI,kBAAM,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB;IACrC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;CACvC,CAAC,CAAA;AAEF,0BAA0B;AAC1B,MAAM,WAAW,GAAG,sCAAsC,CAAA;AAkB1D,mDAAmD;AACnD,MAAM,iBAAiB,GAAG,KAAK,IAAwB,EAAE;IACvD,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,SAAS,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AC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QACjE,MAAM,YAAY,GAAG,MAAA,MAAA,YAAY,CAAC,CAAC,CAAC,0CAAE,GAAG,0CAAE,MAAgB,CAAA;QAE3D,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;QACvC,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;QAClD,OAAO,CAAC,GAAG,CAAC,oCAAoC,YAAY,EAAE,CAAC,CAAA;IACjE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAA;QAClD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC,CAAA;AAED,yBAAyB;AACzB,KAAK,aAAa,EAAE,CAAA"}
@@ -1,3 +1,3 @@
1
1
  import { ChatPromptTemplate } from '@langchain/core/prompts';
2
- export declare const systemPromptWithDates: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a **thorough and precise** medical assistant.\nYou will receive:\n1. A list (array) of **appointments** for a single patient (in JSON format).\n2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.\n\n- You must be **thorough** in your search but only return results when you are **certain** that they match.\n- If multiple appointments match, return **all** their IDs.\n- If no appointments match, return an empty array—this is a valid outcome.\n- Be **meticulous when evaluating time-based criteria**, ensuring all matches are **precise** relative to ${currentDateTime}.\n\n---\n### **Important Instructions**\n- **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.\n - Example: \"Rx\" relates to prescription or medication follow-up, \"PT\" refers to physical therapy, \"f/u\" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.\n- **Only return matches when you are certain**:\n - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.\n - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.\n- **Evaluate time constraints precisely**:\n - If the instruction mentions \"past\" appointments, **only include** those scheduled **before** ${currentDateTime}.\n - If \"future\" appointments are requested, **only include** those scheduled **after** ${currentDateTime}.\n - If an exact date is specified, match it **precisely**.\n - For relative time windows (e.g., within the next 12 hours):\n - Calculate the exact time difference between an appointment's scheduled date/time and ${currentDateTime}.\n - Example: If an appointment is scheduled at a time such that the time difference from ${currentDateTime} is more than 0 but less than or equal to 12 hours, then it qualifies.\n - It is critical to ensure the accuracy of your time comparison. Double check your calculation and reasoning.\n- **Only include appointment IDs that exist in the provided input array**.\n- **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.\n\n\n----------\nPatient Appointments:\n${appointments}\n----------\nInstructions:\n${prompt}\n\nYour output must be a valid JSON object with the following fields:\n\n- appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.\n- explanation: A concise, human-readable explanation that clearly describes:\n - How and why the selected appointments match the input criteria.\n - Why any appointments were excluded, if relevant.\n - Any edge cases or specific reasoning behind your selection.\n\n## Critical Requirements\n### Ensure that the explanation strictly matches the appointmentIds:\n- If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.\n- If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.\n\n### Be thorough and precise:\n- Carefully **analyze all appointments** before making a decision.\n- **Double-check** your reasoning to confirm that **only valid matches** are included.\n- Ensure that no appointments that **do not meet the criteria** are selected.\n- **Maintain strict consistency** between appointmentIds and explanation.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.\n">, any>;
3
- export declare const systemPromptWithoutDates: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a **thorough and precise** medical assistant.\nYou will receive:\n1. A list (array) of **appointments** for a single patient (in JSON format).\n2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.\nTranslate the instructions into a set of granular criteria, then go through the list of appointments and evaluate each criteria separately, and in a final pass keep only the appointments that meet all of the criteria.\n\n- You must be **thorough** in your search but only return results when you are **certain** that they match.\n- If multiple appointments match, return **all** their IDs.\n- If no appointments match, return an empty array—this is a valid outcome.\n- The current date is {currentDateTime}\n\n---\n### **Important Instructions**\n- **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.\n - Example: \"Rx\" relates to prescription or medication follow-up, \"PT\" refers to physical therapy, \"f/u\" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.\n- **Only return matches when you are certain**:\n - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.\n - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.\n- **Do not exclude appointments based on their scheduled date**.\n- **Only include appointment IDs that exist in the provided input array**.\n- **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.\n\n\n----------\nPatient Appointments:\n{appointments}\n----------\nInstructions:\n{prompt}\n\nYour output must be a valid JSON object with the following fields:\n\n- appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.\n- explanation: A concise, human-readable explanation that clearly describes:\n - How and why the selected appointments match the input criteria.\n - Why any appointments were excluded, if relevant.\n - Any edge cases or specific reasoning behind your selection.\n\n## Critical Requirements\n### Ensure that the explanation strictly matches the appointmentIds:\n- If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.\n- If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.\n\n### Be thorough and precise:\n- Carefully **analyze all appointments** before making a decision.\n- **Double-check** your reasoning to confirm that **only valid matches** are included.\n- **Maintain strict consistency** between appointmentIds and explanation.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.">, any>;
2
+ export declare const systemPromptWithDates: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a **thorough and precise** medical assistant.\nYou will receive:\n1. A list (array) of **appointments** for a single patient (in JSON format).\n2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.\n\n- You must be **thorough** in your search but only return results when you are **certain** that they match.\n- If multiple appointments match, return **all** their IDs.\n- If no appointments match, return an empty array—this is a valid outcome.\n- Be **meticulous when evaluating time-based criteria**, ensuring all matches are **precise** relative to ${currentDateTime}.\n\n---\n### **Important Instructions**\n- **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.\n - Example: \"Rx\" relates to prescription or medication follow-up, \"PT\" refers to physical therapy, \"f/u\" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.\n- **Only return matches when you are certain**:\n - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.\n - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.\n- **Evaluate time constraints precisely**:\n - If the instruction mentions \"past\" appointments, **only include** those scheduled **before** ${currentDateTime}.\n - If \"future\" appointments are requested, **only include** those scheduled **after** ${currentDateTime}.\n - If an exact date is specified, match it **precisely**.\n - For relative time windows (e.g., \"within the next 12 hours\"):\n - Calculate the exact time difference between an appointment's scheduled date/time and ${currentDateTime}.\n - Example: If an appointment is scheduled at a time such that the time difference from ${currentDateTime} is more than 0 but less than or equal to 12 hours, then it qualifies.\n - It is critical to ensure the accuracy of your time comparison. Double check your calculation and reasoning.\n- **Only include appointment IDs that exist in the provided input array**.\n- **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.\n- **Regardless of phrasing, always find ALL matching appointments**:\n - Even if the instruction says \"find one appointment\" or \"cancel an appointment,\" you must return ALL appointments that match the criteria.\n - Your job is always to identify every appointment that matches the specified criteria, not to limit results based on phrasing.\n- **Treat quoted terms as exact matches with only format variations**:\n - When terms appear in quotes (e.g., \"checked in\"), match only to that specific term and minor format variations.\n - Example: \"checked in\" would match \"Checked In\", \"checked in\", \"checked-in\", but NOT \"checked out\", \"not checked in\", or any semantically different status.\n - Do not assume semantic equivalence or infer relationships unless explicitly stated.\n\n----------\nPatient Appointments:\n${appointments}\n----------\nInstructions:\n${prompt}\n\nYour output must be a valid JSON object with the following fields:\n\n- appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.\n- explanation: A concise, human-readable explanation that clearly describes:\n - How and why the selected appointments match the input criteria.\n - Why any appointments were excluded, if relevant.\n - Any edge cases or specific reasoning behind your selection.\n\n## Critical Requirements\n### Ensure that the explanation strictly matches the appointmentIds:\n- If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.\n- If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.\n\n### Be thorough and precise:\n- Carefully **analyze all appointments** before making a decision.\n- **Double-check** your reasoning to confirm that **only valid matches** are included.\n- Ensure that no appointments that **do not meet the criteria** are selected.\n- **Maintain strict consistency** between appointmentIds and explanation.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.\n- **Final verification**: Before finalizing, verify that each appointment in appointmentIds meets **ALL** criteria specified in the instructions. Remove any appointment that fails to meet even a single criterion.\n">, any>;
3
+ export declare const systemPromptWithoutDates: ChatPromptTemplate<import("@langchain/core/prompts").ParamsFromFString<"\nYou are a **thorough and precise** medical assistant.\nYou will receive:\n1. A list (array) of **appointments** for a single patient (in JSON format).\n2. A set of **instructions** (written by a clinician, for a clinician) specifying which types of appointments to find.\n\n---\n### **Your Task**\nYour goal is to carefully analyze the provided instructions and the list of appointments to **identify only those that match the instructions**.\nTranslate the instructions into a set of granular criteria, then go through the list of appointments and evaluate each criteria separately, and in a final pass keep only the appointments that meet all of the criteria.\n\n- You must be **thorough** in your search but only return results when you are **certain** that they match.\n- If multiple appointments match, return **all** their IDs.\n- If no appointments match, return an empty array—this is a valid outcome.\n- The current date is {currentDateTime}\n\n---\n### **Important Instructions**\n- **Interpret clinically**: Instructions are written by a clinician for a clinician. Understand medical terminology correctly.\n - Example: \"Rx\" relates to prescription or medication follow-up, \"PT\" refers to physical therapy, \"f/u\" means follow-up. 2x/wk means 2 times a week while 2:1 means two patients per one clinician.\n- **Only return matches when you are certain**:\n - Use your expertise for matching but do not assume connections—appointments must explicitly fit the given instructions.\n - If an instruction is vague or ambiguous, only match appointments if the data supports it directly.\n- **Do not exclude appointments based on their scheduled date**.\n- **Only include appointment IDs that exist in the provided input array**.\n- **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.\n- **Regardless of phrasing, always find ALL matching appointments**:\n - Even if the instruction says \"find one appointment\" or \"cancel an appointment,\" you must return ALL appointments that match the criteria.\n - Your job is always to identify every appointment that matches the specified criteria, not to limit results based on phrasing.\n- **Treat quoted terms as exact matches with only format variations**:\n - When terms appear in quotes (e.g., \"checked in\"), match only to that specific term and minor format variations.\n - Example: \"checked in\" would match \"Checked In\", \"checked in\", \"checked-in\", but NOT \"checked out\", \"not checked in\", or any semantically different status.\n - Do not assume semantic equivalence or infer relationships unless explicitly stated.\n\n----------\nPatient Appointments:\n{appointments}\n----------\nInstructions:\n{prompt}\n\nYour output must be a valid JSON object with the following fields:\n\n- appointmentIds: An array containing the IDs of appointments that match the given criteria. If no appointments meet the criteria, this array must be empty.\n- explanation: A concise, human-readable explanation that clearly describes:\n - How and why the selected appointments match the input criteria.\n - Why any appointments were excluded, if relevant.\n - Any edge cases or specific reasoning behind your selection.\n\n## Critical Requirements\n### Ensure that the explanation strictly matches the appointmentIds:\n- If appointmentIds contains **selected appointments**, the explanation must accurately describe **why they were chosen**.\n- If appointmentIds is **empty**, the explanation must clearly state **why no matches were found**.\n\n### Be thorough and precise:\n- Carefully **analyze all appointments** before making a decision.\n- **Double-check** your reasoning to confirm that **only valid matches** are included.\n- **Maintain strict consistency** between appointmentIds and explanation.\n- **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.\n- **Final verification**: Before finalizing, verify that each appointment in appointmentIds meets **ALL** criteria specified in the instructions. Remove any appointment that fails to meet even a single criterion.\n">, any>;
@@ -28,13 +28,19 @@ Your goal is to carefully analyze the provided instructions and the list of appo
28
28
  - If the instruction mentions "past" appointments, **only include** those scheduled **before** \${currentDateTime}.
29
29
  - If "future" appointments are requested, **only include** those scheduled **after** \${currentDateTime}.
30
30
  - If an exact date is specified, match it **precisely**.
31
- - For relative time windows (e.g., within the next 12 hours):
31
+ - For relative time windows (e.g., "within the next 12 hours"):
32
32
  - Calculate the exact time difference between an appointment's scheduled date/time and \${currentDateTime}.
33
33
  - Example: If an appointment is scheduled at a time such that the time difference from \${currentDateTime} is more than 0 but less than or equal to 12 hours, then it qualifies.
34
34
  - It is critical to ensure the accuracy of your time comparison. Double check your calculation and reasoning.
35
35
  - **Only include appointment IDs that exist in the provided input array**.
36
36
  - **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.
37
-
37
+ - **Regardless of phrasing, always find ALL matching appointments**:
38
+ - Even if the instruction says "find one appointment" or "cancel an appointment," you must return ALL appointments that match the criteria.
39
+ - Your job is always to identify every appointment that matches the specified criteria, not to limit results based on phrasing.
40
+ - **Treat quoted terms as exact matches with only format variations**:
41
+ - When terms appear in quotes (e.g., "checked in"), match only to that specific term and minor format variations.
42
+ - Example: "checked in" would match "Checked In", "checked in", "checked-in", but NOT "checked out", "not checked in", or any semantically different status.
43
+ - Do not assume semantic equivalence or infer relationships unless explicitly stated.
38
44
 
39
45
  ----------
40
46
  Patient Appointments:
@@ -62,6 +68,7 @@ Your output must be a valid JSON object with the following fields:
62
68
  - Ensure that no appointments that **do not meet the criteria** are selected.
63
69
  - **Maintain strict consistency** between appointmentIds and explanation.
64
70
  - **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.
71
+ - **Final verification**: Before finalizing, verify that each appointment in appointmentIds meets **ALL** criteria specified in the instructions. Remove any appointment that fails to meet even a single criterion.
65
72
  `);
66
73
  exports.systemPromptWithoutDates = prompts_1.ChatPromptTemplate.fromTemplate(`
67
74
  You are a **thorough and precise** medical assistant.
@@ -89,7 +96,13 @@ Translate the instructions into a set of granular criteria, then go through the
89
96
  - **Do not exclude appointments based on their scheduled date**.
90
97
  - **Only include appointment IDs that exist in the provided input array**.
91
98
  - **Do not fabricate matches**—returning an empty array is preferable to an incorrect match.
92
-
99
+ - **Regardless of phrasing, always find ALL matching appointments**:
100
+ - Even if the instruction says "find one appointment" or "cancel an appointment," you must return ALL appointments that match the criteria.
101
+ - Your job is always to identify every appointment that matches the specified criteria, not to limit results based on phrasing.
102
+ - **Treat quoted terms as exact matches with only format variations**:
103
+ - When terms appear in quotes (e.g., "checked in"), match only to that specific term and minor format variations.
104
+ - Example: "checked in" would match "Checked In", "checked in", "checked-in", but NOT "checked out", "not checked in", or any semantically different status.
105
+ - Do not assume semantic equivalence or infer relationships unless explicitly stated.
93
106
 
94
107
  ----------
95
108
  Patient Appointments:
@@ -115,5 +128,7 @@ Your output must be a valid JSON object with the following fields:
115
128
  - Carefully **analyze all appointments** before making a decision.
116
129
  - **Double-check** your reasoning to confirm that **only valid matches** are included.
117
130
  - **Maintain strict consistency** between appointmentIds and explanation.
118
- - **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.`);
131
+ - **Do not contradict yourself**: The explanation must always align with the selected appointments appointmentIds. Double check your explanation against the appointmentIds.
132
+ - **Final verification**: Before finalizing, verify that each appointment in appointmentIds meets **ALL** criteria specified in the instructions. Remove any appointment that fails to meet even a single criterion.
133
+ `);
119
134
  //# sourceMappingURL=prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,qBAAqB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DpE,CAAC,CAAA;AAEW,QAAA,wBAAwB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6KAoDqG,CAAC,CAAA"}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../extensions/elation/lib/findAppointmentsWithLLM/prompt.ts"],"names":[],"mappings":";;;AAAA,qDAA4D;AAE/C,QAAA,qBAAqB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEpE,CAAC,CAAA;AAEW,QAAA,wBAAwB,GAAG,4BAAkB,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DvE,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awell-health/awell-extensions",
3
- "version": "2.0.237",
3
+ "version": "2.0.238",
4
4
  "packageManager": "yarn@4.5.3",
5
5
  "main": "dist/src/index.js",
6
6
  "repository": {