How to Craft Human‑like RAG Prompts for AI Customer Service

This article explains why prompt engineering is essential for turning large‑language‑model‑driven chatbots into empathetic assistants, outlines a 5W1H framework for designing structured prompts, provides concrete travel‑assistant examples, and shares practical techniques and tools such as Prompt Optimizer to improve RAG reliability.

Ubiquitous Tech
Ubiquitous Tech
Ubiquitous Tech
How to Craft Human‑like RAG Prompts for AI Customer Service

Prompt Engineering Overview

Prompt engineering translates human intent into precise model instructions, aligning LLM behavior without fine‑tuning and enabling rapid iteration. In AI‑driven customer service, it bridges the gap between raw model capabilities and empathetic, context‑aware responses.

5W1H of Prompt Engineering for RAG‑Based Customer Service

What – Structured natural‑language inputs that control LLM output, turning a generic answer generator into a dialogue‑oriented assistant.

Why – LLMs are highly general but default outputs are uncontrolled; prompts guide behavior.

Where – Applicable to e‑commerce, finance, healthcare, government hotlines, and any domain requiring human‑like interaction.

When – Needed whenever high‑quality natural‑language output, behavior guidance, or rapid feature validation (e.g., emotional response, business‑knowledge matching) is required.

Who – AI product managers, prompt engineers, front‑end/back‑end developers, and operations staff.

How – Follow a spiral development loop: requirement analysis → prompt prototype → A/B testing → data labeling → effect evaluation. Explicitly define role, background, goal, rules, skills, workflow, examples, and constraints.

Structured Prompt Template

A typical structured prompt contains the following sections:

# Role
You are a senior online travel assistant for Tongcheng Travel, polite and patient.

# Language Style
Use concise, friendly Chinese, avoid jargon.

# Goal
Provide accurate answers about train tickets, attractions, flights, and visas based on supplied knowledge.

# Rules
1. Answer only using provided knowledge.
2. If information is missing, reply "I don't have complete information."
3. Keep tone warm and conversational.

# Skills
- Empathy
- Small‑talk
- Guiding users to travel topics
- Providing factual travel information

# Workflow
1. Receive user input.
2. Identify intent (train ticket, attraction, etc.).
3. Retrieve relevant knowledge.
4. Generate response following rules.
5. If no intent, continue friendly chat.

# Examples
User: "I feel bored."
AI: "I understand that feeling. Want to talk about a place you'd like to visit?"

# Constraints
Do not use official terminology or API calls; never say "I don't know" in a cold way.

Tool Support

The open‑source Prompt Optimizer can automatically improve prompts. Repository: https://github.com/linshenkx/prompt-optimizer (proxy: https://kkgithub.com/linshenkx/prompt-optimizer). It provides a web UI and a Chrome extension.

Workflow Integration

In a production pipeline, the first node classifies incoming queries into categories (train ticket, membership, attraction, other). Non‑travel queries trigger a casual‑chat fallback. The classification results guide the RAG component to answer only when the knowledge base contains relevant information; otherwise the system replies with a graceful deferral.

Common RAG Prompt Practices

Precise Question + Context – Refine the user question, then attach the most relevant knowledge snippet before asking the model to answer.

Let the Model Admit Ignorance – Add a clause such as "If the provided content is insufficient, respond with 'I don't have complete information.'" to avoid hallucinations.

Require Direct Citation – Append "Please answer based on the original text" to force fidelity to the source.

Prompt Optimization Example

Original prompt:

你是一个同程旅行网的专业客服,我希望你可以帮助用户回答关于火车票、景点、机票、签证相关的回答,我会给你提供一些知识,请基于我提供的知识范围进行作答。

Optimized structured prompt (generated by Prompt Optimizer):

# Role
你是一名隶属于【同程旅行网】的资深在线客服助手,具备专业的旅行服务知识,能够礼貌、耐心、准确地为用户提供帮助。

# Language Style
请使用简洁、友好、专业的中文进行回答,语气亲切,表达清晰,避免使用专业术语或复杂句式,确保用户易于理解。

# Goal
你的目标是:基于用户提问内容和我提供的知识信息,为用户提供有关“火车票”、“景点门票”、“机票预订”、“签证办理”等方面的解答,并帮助他们顺利完成旅行相关事务。

# Rules
1. 所有回答仅基于我提供的知识内容,不擅自编造信息或引用外部资料。
2. 如无法提供帮助,请礼貌回复“目前我没有相关信息”。
3. 回答时尽量结合用户问题中的关键词,保持上下文一致。
4. 如用户表达不清或问题模糊,可提出澄清性问题进行引导。

# Skills
- 能够理解并解析用户提出的问题意图。
- 能够从提供的知识中提取相关内容并组织成答复。
- 能够识别请求类型,如查询类、操作类、建议类等。
- 能够进行步骤式说明,例如如何预订、如何退票等。

# Workflow
1. 接收用户输入的问题。
2. 确认是否属于“火车票、景点、机票、签证”四类服务范围。
3. 在提供的知识中查找对应内容。
4. 若匹配到信息,则组织语言并输出答复。
5. 如未匹配到信息,则输出标准引导语。

# Examples
- 用户问:“怎么买学生票?”
  回答:“您可以在购票页面选择乘客类型为‘学生’,并按照提示填写学生证信息后提交订单即可。”
- 用户问:“可以改签火车票吗?”
  回答:“根据我掌握的信息,火车票支持改签,但需在开车前办理,具体操作请参考我提供的改签流程。”

# Constraints
- 不能编造未提供的信息。
- 不涉及价格预测、政策变更或法律类问题。
- 不对用户提出的无关话题进行回答。

RAG Prompt Techniques

Method 1: Precise Question + Associated Information – Refine the user query (or rewrite it) and then concatenate the most relevant knowledge snippet before invoking the LLM.

Method 2: Let RAG Say “I don’t know” – Include a clause such as "If the provided content is insufficient, respond with 'I don't have complete information.'" to handle missing data gracefully.

Method 3: Require Original Text Citation – Append a directive like "User question XXXXX, please answer based on the original text" to force the model to quote the source.

Summary of Core Practices

Prompt engineering is essential for turning LLMs into human‑like agents.

Use a structured prompt format that defines role, goal, rules, skills, workflow, examples, and constraints.

Iterate prompts via a spiral process (requirement → prototype → A/B test → labeling → evaluation).

Apply practical tricks – precise queries, explicit "I don't know" handling, and citation requirements – to reduce hallucinations.

Leverage tools like Prompt Optimizer and community resources (e.g., LangGPT documentation) for systematic improvement.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AI Toolsprompt engineeringRAGLarge Language ModelChatbotAI Customer ServiceStructured Prompts
Ubiquitous Tech
Written by

Ubiquitous Tech

A ubiquitous public account for pirate enthusiasts, regularly sharing curated experiences, tech learning, and growth insights. Currently publishing articles on AI RAG customer service, AI MCP technology, and open-source design. Personal free Knowledge Planet: Awakening New World Programmer.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.