fix: enforce strict JSON output in LLM prompts
Build Agents Runtime / build (push) Successful in 1m14s Details

This commit is contained in:
Deep Koluguri 2026-05-22 21:17:36 -04:00
parent 571c0b0eaa
commit dbd68fc529
1 changed files with 3 additions and 0 deletions

View File

@ -29,6 +29,7 @@ async def structure_note_activity(raw_dictation: str) -> dict:
prompt = PromptTemplate.from_template(
"You are an expert AI Medical Scribe. Extract the clinical information from the following raw dictation and structure it perfectly.\n\n"
"IMPORTANT: You must output ONLY RAW VALID JSON. Do not include any conversational text, explanations, or formatting like '```json'. Start immediately with '{{' and end with '}}'.\n\n"
"Dictation:\n{dictation}\n"
)
@ -52,6 +53,7 @@ async def generate_billing_codes_activity(clinical_note_dict: dict) -> dict:
prompt = PromptTemplate.from_template(
"You are an expert Medical Coder. Review the following structured clinical note and identify all applicable ICD-10 diagnosis codes and CPT procedure codes.\n"
"Provide a clear justification for each code based solely on the provided clinical note.\n\n"
"IMPORTANT: You must output ONLY RAW VALID JSON. Do not include any conversational text, explanations, or markdown formatting like '```json'. Start immediately with '{{' and end with '}}'.\n\n"
"Clinical Note:\n{note}\n"
)
@ -75,6 +77,7 @@ async def analyze_lab_anomaly_activity(input_data: dict) -> dict:
prompt = PromptTemplate.from_template(
"You are an expert AI Medical Diagnostic Assistant.\n"
"Review the following patient data and the new lab result. Determine if there is a dangerous anomaly or correlation (e.g., a lab result that is dangerous given the patient's current medications or baseline).\n\n"
"IMPORTANT: You must output ONLY RAW VALID JSON. Do not include any conversational text, explanations, or formatting like '```json'. Start immediately with '{{' and end with '}}'.\n\n"
"Baseline Conditions: {baseline}\n"
"Current Medications: {medications}\n"
"New Lab Result: {new_lab_result}\n\n"