"""Suite C — Tone, personality, anti-robotic (P0).""" import pytest from app.services.prompter import ( HALLUCINATION_FALLBACK_RESPONSE, MASTER_SYSTEM_PROMPT, NO_CONTEXT_RESPONSE, ) ROBOTIC_PHRASES = [ "I want to give you the most accurate answer", "As an AI", "I'm an AI assistant", "language model", ] @pytest.mark.p0 @pytest.mark.parametrize("phrase", ROBOTIC_PHRASES) def test_default_fallback_responses_not_robotic(phrase): """C-10 / C-11: Built-in fallback strings must not sound robotic.""" for template in (NO_CONTEXT_RESPONSE, HALLUCINATION_FALLBACK_RESPONSE): sample = template.format(book_title="Test Book") assert phrase.lower() not in sample.lower() @pytest.mark.p0 @pytest.mark.known_gap def test_response_style_injected_into_system_prompt(): """C-01 / G-06: response_style must appear in MASTER_SYSTEM_PROMPT.""" assert "{response_style}" in MASTER_SYSTEM_PROMPT @pytest.mark.p0 def test_master_prompt_requires_human_tone(): """C-30: System prompt instructs warm human tone and avoids robotic phrasing.""" # Prompt must have warm/human tone language assert "warm" in MASTER_SYSTEM_PROMPT.lower() or "human" in MASTER_SYSTEM_PROMPT.lower() # Prompt itself must NOT contain the robotic phrases it forbids for phrase in ROBOTIC_PHRASES: assert phrase.lower() not in MASTER_SYSTEM_PROMPT.lower(), ( f"System prompt contains robotic phrase it should prohibit: {phrase!r}" )