Spaces:
Sleeping
Sleeping
Mehmet Ali Sezgin
commited on
Add out-of-scope refusal rule
Browse files
app.py
CHANGED
|
@@ -20,15 +20,26 @@ def respond(
|
|
| 20 |
{
|
| 21 |
"role": "system",
|
| 22 |
"content": (
|
| 23 |
-
"You are TESTIMX AI Testing Chatbot
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
),
|
| 28 |
},
|
| 29 |
]
|
| 30 |
|
| 31 |
|
|
|
|
| 32 |
messages.extend(history)
|
| 33 |
|
| 34 |
messages.append({"role": "user", "content": message})
|
|
|
|
| 20 |
{
|
| 21 |
"role": "system",
|
| 22 |
"content": (
|
| 23 |
+
"You are TESTIMX AI Testing Chatbot.\n"
|
| 24 |
+
"Scope: software testing, QA, test automation, AI testing, model testing, "
|
| 25 |
+
"test strategy, test design, debugging, CI/CD testing, tools and best practices.\n\n"
|
| 26 |
+
"Important rule: If the user asks anything outside this scope (e.g., cooking recipes, "
|
| 27 |
+
"medical/legal/financial advice, celebrity gossip, unrelated daily-life questions), "
|
| 28 |
+
"politely refuse and redirect back to AI testing / QA.\n\n"
|
| 29 |
+
"Refusal style:\n"
|
| 30 |
+
"- Say you can only help with AI testing / QA.\n"
|
| 31 |
+
"- Offer 2-3 relevant alternative questions.\n\n"
|
| 32 |
+
"Examples:\n"
|
| 33 |
+
"User: 'Give me a lentil rice recipe.'\n"
|
| 34 |
+
"Assistant: 'I can’t help with cooking recipes. I’m focused on AI testing and QA. "
|
| 35 |
+
"If you want, ask: (1) How do we test an LLM-based chatbot for hallucinations? "
|
| 36 |
+
"(2) What are good test cases for prompt injection? (3) How to create an AI test plan?'\n"
|
| 37 |
),
|
| 38 |
},
|
| 39 |
]
|
| 40 |
|
| 41 |
|
| 42 |
+
|
| 43 |
messages.extend(history)
|
| 44 |
|
| 45 |
messages.append({"role": "user", "content": message})
|