About MOM's Bridge
Prompt Improvement Log
AI / GenAI DocumentationBefore/after prompt pairs showing iterative improvement of AI prompts.
Iteration 1: Unstructured to Structured Output
| Prompt | Problem/Improvement | |
|---|---|---|
| Before | You are a pregnancy assistant. Help the user with their symptom. | Returned long, unparseable text responses |
| After | Respond in JSON only: { "empathetic_response": "...", "doctor_summary": "..." } | Structured, parseable output every time |
Iteration 2: Response Length Control
| Prompt | Problem/Improvement | |
|---|---|---|
| Before | Provide a supportive response and doctor summary | Responses were 200-500 words, too long for mobile display |
| After | Brief supportive message (max 50 words), comfort measures (max 20 words) | Concise responses suitable for mobile UI |
Iteration 3: Pregnancy Context Injection
| Prompt | Problem/Improvement | |
|---|---|---|
| Before | Translate this message to Korean: {message} | Generic translation without medical context |
| After | Translate pregnancy-related message to Korean. Context: week {week}. Message: {message} | Medically aware translation with trimester context |
Iteration 4: Safety Truncation
Added server-side safety: empathetic responses capped at 300 characters, comfort measures at 120 characters. Input text truncated to 100 characters for translation calls. This prevents prompt injection via long inputs and ensures consistent UI rendering.