Sub topic 3
Adding persona and context variants deliberately
This chapter assumes you can read simple Python, that you already have a cleaned list of customer questions, and that you know how an AI assistant or AI search feature returns answers. A persona is the person asking a question, such as a first-time buyer. A context is the situation they are in, such as a failed payment. Variants are rewrites of one base prompt that change the persona or the context.
Adding persona and context variants
Start from a base prompt in customer wording. Then change one variable at a time. If you change the persona and the context together, you cannot tell which change caused a different answer.
PERSONAS = ["I am a first-time buyer.", "I am an existing customer."]
CONTEXTS = ["I am on a phone.", "My last payment failed."]
def persona_variants(base_prompt):
variants = [base_prompt]
for persona in PERSONAS:
variants.append(f"{persona} {base_prompt}")
for context in CONTEXTS:
variants.append(f"{base_prompt} {context}")
return variants
for prompt in persona_variants("Can I move my subscription to a different email address?"):
print(prompt)Sampling for demand and rare topics
Pick prompts from each cluster in proportion to real demand, but keep a minimum for small clusters. The thresholds below are a starting rule, not a fixed standard.
| Cluster type | Share of real questions | Prompts to keep |
|---|---|---|
| High-volume | Above 10% | Proportional to frequency |
| Mid-volume | 2% to 10% | At least 2 |
| Rare but important | Under 2% | At least 2, flagged as priority |
Checking against held-out questions
Split your real questions by date. Write prompts from the older questions and hold back the most recent month. Run the held-out questions against your set and check whether the set covers them. Never use held-out questions to write prompts, or the check proves nothing.
Pitfalls to avoid
- Synthetic bias: Staff-written prompts use internal vocabulary that customers do not use.
- Brand leakage: Naming your product in a prompt makes the assistant repeat your name, which inflates results. Keep a version without brand names.
- Leading prompts: Wording such as "Why is our tool the best choice?" pushes the answer. Use neutral questions.
Versioning and refreshing the set
- Give each prompt set a version number and a date.
- Refresh the set on a fixed schedule, such as quarterly.
- Log every added, changed and retired prompt.
- Retire prompts whose source questions have dropped below their cluster threshold.
Exercise
Exercise
You want to test whether a billing question is answered differently for a first-time buyer than for an existing customer. Why should each variant change only the persona and leave the context unchanged?
Show answer
If the persona and context both change, a different answer could come from either one. Changing only the persona isolates its effect, so you can attribute any difference to it.