組織複雜提示範本
結構會提示多個資料來源和合併欄位,以確保清楚且一致。組織良好的提示可減少錯誤、加速疑難排解,並產生更可靠的 AI 輸出。
必要版本
| 提供版本:Lightning Experience |
| 提供版本:具有 Einstein for Platform、適於銷售的 Einstein 或 Agentforce 或 Service 附加元件,或適用於 Agentforce Foundations 的 Enterprise、Performance 及 Unlimited Edition |
複雜提示的挑戰
具有一或兩個合併欄位的簡單提示很簡單。但生產提示通常需要更多資料,且若沒有適當的組織,則會難以閱讀、維護和疑難排解。常見問題包括:
- 將合併欄位混合成句子,使更新容易發生錯誤
- 指示與資料之間沒有明確的邊界
- 難以識別哪一個合併欄位是哪一個
- 當發生錯誤時難以疑難排解
使用三個引號將資料與指示分開
三個引號 (""") 會建立可清楚將變數資料與指示分開的視覺容器。這是組織複雜提示最重要的技術。三次引號之間的所有內容都會視為資料或內容,與您的指示不同。
不含三次引號
You are a customer service representative. Write a follow-up email to {!Contact.FirstName} {!Contact.LastName} at {!Account.Name} about their case {!Case.Subject} which was created on {!Case.CreatedDate} and is currently {!Case.Status} with priority {!Case.Priority}. Their account details show they're on the {!Account.Support_Tier__c} support tier. Make sure to reference the resolution notes: {!Case.Resolution__c}. Be professional and empathetic. Keep it under 200 words.含三個引號
You are a customer service representative.
Task: Write a follow-up email about the customer's support case
"""
Contact Information:
Name: {!Contact.FirstName} {!Contact.LastName}
Account: {!Account.Name}
Support Tier: {!Account.Support_Tier__c}
Case Details:
Subject: {!Case.Subject}
Created: {!Case.CreatedDate}
Status: {!Case.Status}
Priority: {!Case.Priority}
Resolution: {!Case.Resolution__c}
"""
Instructions:
- Greet the customer by first name
- Reference the case subject
- Confirm the case status and resolution
- Thank them for their patience
- Provide next steps if any
Tone: Professional and empathetic
Length: Under 200 words使用三個引號可讓您輕鬆新增、移除或修改欄位,並將指示與資料完全分開。
在三個報價之內組織資料
在三引號區塊內,使用這些技巧以邏輯的方式組織合併欄位。
依物件分組
"""
Account Information:
{!Account.Name}
{!Account.Industry}
{!Account.Annual_Revenue__c}
Contact Information:
{!Contact.FirstName}
{!Contact.LastName}
{!Contact.Email}
Case Information:
{!Case.Subject}
{!Case.Status}
{!Case.Priority}
"""使用標籤
為每個欄位提供人類可讀的標籤。標籤可協助 AI 模型瞭解每個資料代表的內容,特別是當欄位名稱為密碼時。
"""
Customer: {!Contact.FirstName} {!Contact.LastName}
Company: {!Account.Name}
Issue: {!Case.Subject}
Opened: {!Case.CreatedDate}
Priority: {!Case.Priority}
Status: {!Case.Status}
"""遵循參照一次原則
作為一般規則,請在您的提示範本中精確包含每個資料片段一次。重複重複相同的合併欄位會導致結果不一致,並使提示難以維護。將所有合併欄位放置在單一資料區段中,然後在指示中以概念的方式參照這些欄位,而不重複合併欄位語法。
使用多個報價區段
針對非常複雜的提示,請使用多個三引號區段來分隔不同類型的資料。例如,針對變數資料使用一個區塊,針對引導語調和結構的靜態範例使用第二個區塊。
"""
Prospect Information:
Name: {!Lead.FirstName} {!Lead.LastName}
Company: {!Lead.Company}
Industry: {!Lead.Industry}
"""
Instructions:
- Personalize based on their industry
- Reference a common pain point
- End with a soft call to action
"""
Example tone and structure:
Hi [Name],
I noticed [Company] is in [Industry]. Many [Industry] leaders we work with struggle with [Pain Point].
Would you be open to a quick 15-minute call?
"""處理空白或遺漏的欄位
當使用許多合併欄位時,某些記錄可能為空白。使用回復指示告知 AI 如何妥善處理遺漏值。
Instructions:
- Greet contact by name
- Reference account name
- If Support Tier is populated, mention their tier level
- If Annual Revenue is populated, acknowledge their business size
- If fields are empty, skip mentioning them (don't say "no tier" or "unknown revenue")結構非常長提示
當提示超出一個畫面時,請使用清除區段標題,使其可掃描且易於維護。
========================================
ROLE
========================================
[Role definition]
========================================
DATA
========================================
"""
[All merge fields organized by object]
"""
========================================
TASK
========================================
[What to produce]
========================================
INSTRUCTIONS
========================================
[Step-by-step instructions]
========================================
FORMAT
========================================
[Response structure requirements]
========================================
CONSTRAINTS
========================================
[Boundaries and limits]
========================================常見的組織錯誤
| 錯誤 | 問題 | 解決方案 |
|---|---|---|
| 混合資料與指示 | 難以剖析資料與指示為何 | 使用三個引號來分隔 |
| 合併欄位沒有標籤 | AI 無法瞭解資料的意義 | 新增描述性標籤 |
| 重複相同的合併欄位 | 不一致的結果 | 請參照每個欄位一次 |
| 隨機欄位順序 | 難以掃描和維護 | 依物件或內容分組 |
| 無區段標題 | 無法瀏覽長提示 | 新增清除區段 |
| 密碼欄位名稱 | AI 誤解資料 | 使用純文字標籤 |
組織檢查清單
完成複雜提示範本前,請先驗證這些項目。
- 所有變數資料都包含在三引號區塊中
- 每個合併欄位僅會參照一次
- 合併欄位具有明確且人類可讀的標籤
- 欄位會依邏輯分組 (依物件或內容)
- 區段標題會分隔主要元件
- 指示與資料完全分開
- 提示可掃描 (尋找 10 秒內的任何欄位)
- 已處理空白與遺漏的欄位處理
此文章是否解決您的問題?
請讓我們知道,以便我們改進!

