# System prompts for LLM interaction # --- Initial Prompt Components --- ANSWER_FORMAT_INSTRUCTIONS = { "MCQ_SINGLE_CORRECT": "Pick the single correct option (e.g., A, B, 1, 2).", "INTEGER": "Find the numerical answer (integer or decimal).", "MCQ_MULTIPLE_CORRECT": "Pick all correct options (e.g., A,C or 1,3), comma-separated.", "DEFAULT": "Answer based on the question's format." } EXAMPLE_INSTRUCTIONS = { "MCQ_SINGLE_CORRECT": "- A\n- 2", "INTEGER": "- 5\n- 12.75", "MCQ_MULTIPLE_CORRECT": "- A,C\n- 1,3\n- B", "DEFAULT": "- Your Answer" } INITIAL_PROMPT_TEMPLATE = """Look at this {exam_name} {exam_year} exam question ({question_type}). {answer_format_instruction} Respond with ONLY an tag. No other text. {example_instruction} - Unsure: SKIP""" # --- Reprompt Components --- SPECIFIC_INSTRUCTIONS_REPROMPT = { "MCQ_SINGLE_CORRECT": "provide the correct option (e.g., A or 2)", "INTEGER": "provide the numerical answer", "MCQ_MULTIPLE_CORRECT": "provide all correct options comma-separated (e.g., A,C)", "DEFAULT": "provide the answer" } REPROMPT_EXAMPLE_INSTRUCTIONS = { "MCQ_SINGLE_CORRECT": "A", "MCQ_MULTIPLE_CORRECT": "A,C", "INTEGER": "42", "DEFAULT": "Your Answer", } REPROMPT_PROMPT_TEMPLATE = """Your previous response was not in the correct format. Previous response: {previous_raw_response} This is a '{question_type}' question. Please {specific_instructions} in an tag. Example: {reprompt_example_instruction} Unsure: SKIP Respond with ONLY the tag. No other text.""" # --- Helper functions to get instructions --- def get_answer_format_instruction(question_type: str) -> str: return ANSWER_FORMAT_INSTRUCTIONS.get(question_type, ANSWER_FORMAT_INSTRUCTIONS["DEFAULT"]) def get_example_instruction(question_type: str) -> str: return EXAMPLE_INSTRUCTIONS.get(question_type, EXAMPLE_INSTRUCTIONS["DEFAULT"]) def get_specific_instructions_reprompt(question_type: str) -> str: return SPECIFIC_INSTRUCTIONS_REPROMPT.get(question_type, SPECIFIC_INSTRUCTIONS_REPROMPT["DEFAULT"]) def get_reprompt_example_instruction(question_type: str) -> str: return REPROMPT_EXAMPLE_INSTRUCTIONS.get(question_type, REPROMPT_EXAMPLE_INSTRUCTIONS["DEFAULT"])