system-prompts-and-models-o.../dealix/auto_client_acquisition/agent_observability/safety_eval.py
Sami Assiri b13cb389cc feat(dealix): sync full Dealix package to repo
- API routers, ACA modules, integrations (draft operators)
- Docs, landing pages, scripts (launch readiness, scorecard)
- Tests and CI workflow updates for Dealix

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-01 21:01:17 +03:00

20 lines
602 B
Python

"""Tripwire checks on Arabic marketing copy — deterministic."""
from __future__ import annotations
import re
from typing import Any
_BAD = ("ضمان كامل", "مضمون 100%", "ارسل لي رقم البطاقة", "كلمة المرور", "حسابك معلق")
def evaluate_safety(text_ar: str) -> dict[str, Any]:
t = text_ar or ""
trips: list[str] = []
for phrase in _BAD:
if phrase in t:
trips.append(phrase)
if re.search(r"\b\d{16}\b", t):
trips.append("possible_pan")
return {"passed": len(trips) == 0, "tripwires": trips, "demo": True}