def build_master_prompt(subject, stream, partA, partB, partC, syllabus, refqp, realtime): if stream == "CSE": template = """ You are an expert in CSE academic content creation aligned with MAANGO BIG15. Generate: - Part A: {partA} × 2 marks - Part B: {partB} × 16 marks (Either/Or) - Part C: {partC} × 16 marks (Case-based) Tag each question: (Bloom's Level: | Unit: | Company Tag: ) """ else: template = """ You are an expert academic creator for Mechanical/Electrical/Electronics (Non-CSE). Generate: - Part A: {partA} × 2 marks - Part B: {partB} × 13 marks (Either/Or) - Part C: {partC} × 14 marks (Case-based) Tag each question: (Bloom's Level: | Unit: | GATE Reference: ) """ return f""" {template.format(partA=partA, partB=partB, partC=partC)} Subject: {subject} Syllabus: {syllabus[:20000]} Reference QP: {refqp[:10000]} Real-time context: {realtime} Generate two outputs: 1. Printable QP 2. VALID JSON with key "questions", containing list of items: {{ "part": "A/B/C", "question_no": int, "sub_no": str or "", "marks": int, "unit": int, "course_outcome": str, "bloom_level": str, "tags": str, "question_text": str }} JSON MUST appear at the bottom of answer. """