diff --git a/backend/app/services/ai_service.py b/backend/app/services/ai_service.py index 3734305..7bed936 100644 --- a/backend/app/services/ai_service.py +++ b/backend/app/services/ai_service.py @@ -16,36 +16,52 @@ def _proxy_model(model_id: str) -> str: EXTRACTION_PROMPT = """You are extracting questions from a PREP (Pediatric Review and Education Program) exam PDF. -These PDFs follow a strict format: -1. A numbered question with a clinical vignette (patient scenario) -2. Five answer options labeled A, B, C, D, E -3. A line "Correct Answer: X" where X is the letter of the correct option -4. An explanation paragraph -5. A "Critique:" section with detailed reasoning -6. A "Content Specifications:" section listing the learning objectives +These PDFs have questions with a clinical vignette, followed by five answer options A-E. +Some PDFs include "Correct Answer: X" or "Preferred Response: X" right after the options. +Some PDFs have the correct answers only at the END of the document — in that case correct_answer will be null. -Your task: extract every question and return ONLY a JSON object in this exact format: +Return ONLY a JSON object: {{"questions": [ {{ - "question_text": "", + "item_number": "", + "question_text": "", "question_type": "mcq", "options": ["