Anthropic 为 Claude Haiku 5.5 的 low effort 提供了一份带 few-shot 示例和 XML 标签约束的客服工单分类提示词,可将一条工单归入单一 intent,并分别提取 reasoning 与 intent 供后续路由。
适合的任务:客服工单意图分类、优先级或专家路由的第一步;原文强调简单、高吞吐的请求。类别有限且保留可解释分析是本记录的工程应用建议。
不适合的任务:类别很多、专业知识深或需要复杂推理的请求。不要直接替代完整 SLA 决策、权限判断或高风险人工升级,这属于本记录的工程边界建议;三类示例标签应替换为业务自己的 taxonomy,并用历史工单评测。
适用的模型版本:Claude Haiku 5.5,模型 ID claude-haiku-5-5。
适用的客户端、Agent 或 API:Claude Messages API、Python SDK;输入通过 Python f-string 注入 <request> 标签,输出由正则表达式提取。
推荐的推理档位和参数:output_config={"effort": "low"},max_tokens=2048,stream=False。Anthropic 页面明确说明这份 prompt 按 Haiku 5.5 的 low effort 编写;若使用 Fable 5.1、Fable 5、Opus 5.5、Opus 5 或 Sonnet 5.5,页面建议改为输出 intent 和一句话摘要。
下面保留 Anthropic 页面提供的完整 prompt。页面中的 Example 3 至 Example 8 本身用 ... 省略,使用时应替换为自己的真实标注样本,不应把省略号当作可用示例。
def classify_support_request(ticket_contents):
classification_prompt = f"""You will be acting as a customer support ticket classification system. Your task is to analyze customer support requests and output the appropriate classification intent for each request, along with your reasoning.
Here is the customer support request you need to classify:
<request>{ticket_contents}</request>
Please carefully analyze the above request to determine the customer's core intent and needs. Consider what the customer is asking for has concerns about.
First, write out your reasoning and analysis of how to classify this request inside <reasoning> tags.
Then, output the appropriate classification label for the request inside a <intent> tag. The valid intents are:
<intents>
<intent>Support, Feedback, Complaint</intent>
<intent>Order Tracking</intent>
<intent>Refund/Exchange</intent>
</intents>
A request may have ONLY ONE applicable intent. Only include the intent that is most applicable to the request.
As an example, consider the following request:
<request>Hello! I had high-speed fiber internet installed on Saturday and my installer, Kevin, was absolutely fantastic! Where can I send my positive review? Thanks for your help!</request>
Here is an example of how your output should be formatted (for the above example request):
<reasoning>The user seeks information in order to leave positive feedback.</reasoning>
<intent>Support, Feedback, Complaint</intent>
Here are a few more examples:
<examples>
<example 2>
Example 2 Input:
<request>I wanted to write and personally thank you for the compassion you showed towards my family during my father's funeral this past weekend. Your staff was so considerate and helpful throughout this whole process; it really took a load off our shoulders. The visitation brochures were beautiful. We'll never forget the kindness you showed us and we are so appreciative of how smoothly the proceedings went. Thank you, again, Amarantha Hill on behalf of the Hill Family.</request>
Example 2 Output:
<reasoning>User leaves a positive review of their experience.</reasoning>
<intent>Support, Feedback, Complaint</intent>
</example 2>
<example 3>
...
</example 8>
<example 9>
Example 9 Input:
<request>Your website keeps sending ad-popups that block the entire screen. It took me twenty minutes just to finally find the phone number to call and complain. How can I possibly access my account information with all of these popups? Can you access my account for me, since your website is broken? I need to know what the address is on file.</request>
Example 9 Output:
<reasoning>The user requests help accessing their web account information.</reasoning>
<intent>Support, Feedback, Complaint</intent>
</example 9>
Remember to always include your classification reasoning before your actual intent output. The reasoning should be enclosed in <reasoning> tags and the intent in <intent> tags. Return only the reasoning and the intent.
"""Anthropic 页面给出的 Haiku 5.5 调用配置如下。它要求先生成完整的 reasoning 与 intent,再进行解析,因此使用 stream=False。下面的包装函数把页面的调用与解析片段合并成可运行示例。
import anthropic
import re
client = anthropic.Anthropic()
DEFAULT_MODEL = "claude-haiku-5-5"
def send_and_parse(classification_prompt):
message = client.messages.create(
model=DEFAULT_MODEL,
max_tokens=2048,
output_config={"effort": "low"},
messages=[{"role": "user", "content": classification_prompt}],
stream=False,
)
reasoning_and_intent = next(
(block.text for block in message.content if block.type == "text"), ""
)
reasoning_match = re.search(
r"<reasoning>(.*?)</reasoning>", reasoning_and_intent, re.DOTALL
)
reasoning = reasoning_match.group(1).strip() if reasoning_match else ""
intent_match = re.search(r"<intent>(.*?)</intent>", reasoning_and_intent, re.DOTALL)
intent = intent_match.group(1).strip() if intent_match else ""
return reasoning, intent先根据历史工单、现有 SLA、支持层级和专家团队定义互斥的 intent;示例中的三类标签只是演示。
用真实标注样本补齐 Example 3 至 Example 8,并让每条样本只对应一个 gold intent。
将工单正文作为 ticket_contents,保留 <request> 边界;不要把不可信工单文本直接拼进 system prompt。
以 claude-haiku-5-5、effort=low、max_tokens=2048 运行,解析 <reasoning> 与 <intent>。
评测准确率、每条工单成本、响应时间、重路由率和边界案例;页面给出的示例阈值是 100 个测试中准确率 95%,以及相对现有路由方法平均降低 50% 成本。
类别超过约 20 个时,Anthropic 建议使用 taxonomy tree 和级联分类器;高变化工单可用向量数据库检索相似样本,再把相关示例注入 prompt。
原始 prompt 要求输出 reasoning;生产系统是否保存或展示这部分内容,应按隐私、合规和审计要求单独决定,路由逻辑可只使用 intent。
页面没有为该 prompt 提供固定准确率;“71% 提升到 93%”属于页面对向量检索分类 recipe 的说明,不是本 prompt 在所有工单上的保证。
低 effort 是页面针对 Haiku 5.5 的示例配置。若分类需要大量类别、专业判断或复杂多意图处理,应比较更高 effort 或 Sonnet,而不是只提高 max_tokens。
正则解析失败、多个 intent、未知类别和安全拒答都需要客户端显式处理,不能默认将空字符串路由到某个队列。
页面明确写出:Claude Haiku 5.5 适合以 low effort 处理简单、高吞吐请求,并给出 claude-haiku-5-5、effort=low 和完整分类 prompt。
页面没有公开其示例 prompt 的正式测试集、真实工单样本、重复次数或置信区间;示例阈值是部署评估建议,不是模型基准成绩。
该 prompt 的分类标签、示例和路由规则必须替换为业务自己的定义;直接沿用 Support / Order Tracking / Refund/Exchange 会导致标签与业务队列不匹配。
Claude Haiku 5.5