EXAMPLES: 1."How do I reset my password?"→category:support,urgency:low 2."Where is the password reset option?"→category:support,urgency:low 3."I can't find password settings."→category:support,urgency:low
全是同一种问题。模型学不到边界处理。
良好的 few-shot(多样且含 edge cases):
Example 1 (Standard): Input: "How do I reset my password?" Output: {"category": "support", "urgency": "low", "confidence": 0.95}
Example 2 (Urgent): Input: "URGENT: System down, can't access customer data!" Output: {"category": "support", "urgency": "high", "confidence": 0.98}
Example 3 (Mixed Intent): Input: "I want to upgrade my plan but also report a billing error." Output: {"category": "billing", "urgency": "medium", "confidence": 0.78, "note": "Multiple intents detected"}
Example 4 (Edge Case - Unclear): Input: "help" Output: {"category": "general", "urgency": "low", "confidence": 0.45, "action": "request_clarification"}
为何有效:
覆盖不同场景(标准、紧急、混合、不清楚)
示范如何处理边界(低置信度 → 追问澄清)
展示一致的输出格式
让模型学习决策模式,而非仅做类别匹配
技巧 4:Constraints & Grounding(对抗幻觉)
AI agents 的大问题之一:hallucination(幻觉)。找不到答案时它们会编造。
解决方案:显式约束,将 agent “落地”。
糟糕做法(无约束):
Answer customer support questions basedonour documentation.
后果:找不到信息时 agent 会胡编。
良好做法(显式约束):
Answer customer support questionsusingONLY informationfromthe documentation you can access via search_docs tool.
CONSTRAINTS: -Ifinformationisnotindocs:"I don't have that information in our current documentation. I'll create a ticket for our team to help you." - Never make assumptions about featuresorfunctionality - Never provide workarounds that aren't documented -Ifmultiple solutions exist: Present all documented options ESCALATION CRITERIA: - Customer mentions"urgent","broken","down"→ create ticket immediately - Question requires account-specific data → create ticketwithdetails - Documentationisincomplete/contradictory → create ticket noting the issue
You are a helpful AI assistant designed tohelpcustomerswiththeir questionsandconcerns. You should always be polite, professional,andcourteousinyour responses. Make sure to read the customer's question carefully and provide a thorough and complete answer that addresses all of their concerns. If you'renotsure about something, it's better to say you don't know than to provide incorrect information...
350 个 token 的空话,几乎没有可执行指导。
良好的 context(密度高、具体):
YouareSupport Agent.
RESPONSE REQUIREMENTS: -Max150words -Plainlanguage(non-technical) -Structure: Problem acknowledgment → Solution → Next steps TOOLS: -search_docs(query) →searchproduct documentation -create_ticket(title, priority, details) → escalatetohuman team WORKFLOW: 1.Searchdocsforrelevant information 2.If found: Provide answerwithdoc reference 3.IfnotfoundORcustomer mentions "urgent"/"broken":Createticket
TASK:Analyze customer requestanddetermine best resolution path.
REASONING PROCESS (thinkstep-by-step): 1. IDENTIFY: Whatisthe core issue? (Quote specific partsofmessage) 2. CLASSIFY: Which category? (sales/support/billing/general) 3. ASSESS URGENCY: Time-sensitive keywords? Tone indicators? 4. CHECK PREREQUISITES: Can we resolvewithavailable tools? 5. DECIDE: Routetoappropriate handlerwithreasoning Think througheachstepexplicitly before providing your final answer.
Answer the customer's question using ONLY the information provided below.
CONTEXT FROM DOCUMENTATION: {{$json.retrieved_chunks}} CUSTOMER QUESTION: {{$json.user_message}} INSTRUCTIONS: - Base answer strictly on provided context - If context doesn't contain the answer:"I don't have that information in our current documentation." - Include source reference:"According to [doc_title]..." - If multiple relevant sections: Synthesize informationfromall CONFIDENCE ASSESSMENT: - High confidence: Answer directly statedincontext - Medium confidence: Answer can be inferredfromcontext - Low confidence: Contextisincomplete → escalate
模式 3:Document Repacking——顺序比你想的更重要
Wang 等(2024)研究发现:context 的“顺序”影响显著。
发现要点:
Primacy bias:模型更注意开头的信息
Recency bias:也更注意结尾的信息
Middle neglect:中间的信息更容易被忽略
性能影响:通过最优排序可提升 5–10% 准确度
最优排序策略:
最相关/最重要的信息放最前
次要的支持信息放中间
约束与提醒放最后(利用近因效应)
示例(RAG context):
MOST RELEVANT DOCUMENTATION: [Chunk with highest relevance score]
ADDITIONAL CONTEXT: [Supporting chunks] CONSTRAINTS (IMPORTANT): - Answer onlyfromprovided context - If uncertain: Escalate to human team