Skip to the page
Tecyfy

Prompting interview question · medium

Given a task to create a chatbot for customer service, how would you approach prompt engineering to handle various customer queries effectively?

The full answer

I'd treat the chatbot as a system rather than one prompt: a system prompt that sets the role, tone and boundaries; the company's own help content and the customer's account data retrieved into each request; tools for actions such as checking an order; clear rules for escalating to a person; and an evaluation set of real customer queries to test every change.

1. Learn the queries first Read a sample of real tickets and chats and group them: order status, returns, billing, technical problems, complaints, account changes. Note which need data, which need actions, and which must go to a person (legal threats, safety issues, distressed customers).

2. The system prompt

  • Who the assistant is, who it serves and the tone ("friendly, concise, no jargon").
  • What it may and may not do: no refunds above a limit, no legal or medical advice, no promises the policy doesn't support.
  • How to use the supplied knowledge: answer from the help articles and account data provided; if the answer isn't there, say so and offer a person.
  • When to escalate, and how to hand over with a summary so the customer doesn't repeat themselves.
  • Output rules: short paragraphs, steps as numbered lists, links to help pages.

3. Grounding with retrieval Policies change, so don't rely on the model's general knowledge or long lists of rules in the prompt. Retrieve the relevant help articles for each question (retrieval-augmented generation) and include the customer's order or account details when they are signed in. Ask the model to answer only from them.

4. Tools for actions Give the model functions such as get_order_status(order_id) or start_return(order_id, reason), with clear descriptions. The application, not the model, checks permissions, and sensitive actions ask the customer to confirm.

5. Handling variety

  • Unclear questions: ask one clarifying question rather than guess.
  • Several issues in one message: address each in turn.
  • Angry customers: acknowledge the problem, avoid defensive language, move to a solution or a person.
  • Other languages: reply in the customer's language.
  • Off-topic or abusive input: steer back politely, or end the chat by the stated policy.

6. Safety and security Customers (or text they paste) may try to make the bot ignore its rules. Keep account data and actions behind permission checks, never put secrets in the prompt, and filter outputs for personal data of other customers.

7. Test and improve Build a test set from real conversations, including tricky and adversarial ones, and score answers for correctness against policy, tone, and correct escalation. After launch, review conversations that ended in escalation or low ratings, and add them to the tests.

Last updated 16 October 2026