vihardesu_13901
10/19/2025, 8:30 PMgreg (BAML)
10/19/2025, 8:32 PMvihardesu_13901
10/19/2025, 8:35 PMgreg (BAML)
10/19/2025, 8:40 PMgreg (BAML)
10/19/2025, 8:41 PMgreg (BAML)
10/19/2025, 8:43 PMvihardesu_13901
10/19/2025, 8:44 PM// Template string for structured output extraction from medical documents
// Based on: https://docs.boundaryml.com/ref/baml/template-string
template_string StructuredOutputExtractionPrompt(
document_content: string
) #"
You are a medical data extraction specialist. Your task is to extract structured information from medical documents and format it according to a precise JSON schema.
## Guidelines
- Extract ONLY information that is explicitly present in the document
- If a field is not found, omit it (unless it's required by the schema)
- Pay careful attention to units, values, and data types
- Preserve exact numerical values and dates as they appear
- Do not infer or make up information
- If a value is unclear or ambiguous, omit it rather than guessing
## Document Content
{{ document_content }}
---
## Task
Extract information from the document content above and return it in the exact JSON format specified by the schema. Return ONLY valid JSON matching the schema, with no additional text or commentary.
{{ ctx.output_format }}
"#vihardesu_13901
10/19/2025, 8:45 PM// Extract SUPAR data from medical document text
function ExtractSuPAR(document_text: string) -> SUPARData {
client OpenAIReponsesApiGPT5
prompt #"
You are a medical data extraction specialist. Extract SUPAR (Soluble Urokinase Plasminogen Activator Receptor) test results from the following medical document.
Extract metrics, values, units, and reference ranges. Common metrics include:
- SuPAR Score (ng/ml)
- Rate of Aging (unitless)
- Biological Age (years)
Extract ONLY information that is explicitly present in the document.
If no SUPAR data is found, return an empty list.
## Document Content
{{ document_text }}
{{ ctx.output_format }}
"#
}greg (BAML)
10/19/2025, 8:49 PMgreg (BAML)
10/19/2025, 8:50 PMgreg (BAML)
10/19/2025, 8:56 PMvihardesu_13901
10/19/2025, 11:17 PMVaibhav (BAML 🐑)
10/20/2025, 5:24 AMctx in any template_string as well!Vaibhav (BAML 🐑)
10/20/2025, 5:24 AM