Create constraints.py
Browse files- constraints.py +10 -0
constraints.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# constraints.py
|
| 2 |
+
|
| 3 |
+
FORBIDDEN = ["shutdown", "format", "delete all"]
|
| 4 |
+
|
| 5 |
+
def validate_intent(intent: str) -> tuple[bool, str]:
|
| 6 |
+
text = intent.lower()
|
| 7 |
+
for word in FORBIDDEN:
|
| 8 |
+
if word in text:
|
| 9 |
+
return False, f"Forbidden keyword detected: {word}"
|
| 10 |
+
return True, "OK"
|