flexigo-support-bot / tests /test_prompts.py
victor34593993's picture
robustness: smaller prompt + reliable final answer
96e5581 verified
Raw
History Blame
876 Bytes
from __future__ import annotations
from app.prompts import build_system_prompt
def test_system_prompt_includes_rules_and_brand():
p = build_system_prompt("TOORX Assist")
assert "TOORX Assist" in p
# language rule
assert "idioma" in p.lower()
assert "pt-PT" in p
# anti-hallucination grounding rule
assert "inventes" in p.lower()
# flexible order verification (email + order number / postal code / name)
assert "email" in p and "pedido" in p and "código postal" in p
assert "NUNCA" in p # no full address / payment
assert "campo" in p.lower() # generic failure (don't reveal which field)
# escalation + tools
assert "escalate_to_human" in p
assert "search_knowledge" in p and "search_products" in p and "lookup_order" in p
def test_system_prompt_default_brand():
assert "Asistente" in build_system_prompt("")