Loading
Agentforce 和 Einstein 生成式 AI
目录
选择筛选器

          没有结果
          没有结果
          以下是一些搜索提示

          检查关键字的拼写。
          使用更普遍的搜索词。
          选择更少的筛选器,并扩大搜索范围。

          搜索所有 Salesforce 帮助
          组织复杂提示模板

          组织复杂提示模板

          使用多个数据源和合并字段构建提示,以实现清晰性和一致性。组织良好的提示减少了错误,加快了故障排除,并产生了更加可靠的 AI 输出。

          所需的 Edition

          适用于:Lightning Experience
          适用于:EnterprisePerformanceUnlimited Edition,带有 Einstein for Platform、Einstein 或适用于销售的 Agentforce 或 Service 加载项、Agentforce Foundations

          复杂提示的挑战

          带有一个或两个合并字段的简单提示简单明了。但生产提示通常需要更多数据,如果没有适当的组织,它们变得难以读取、维护和故障排除。常见问题包括:

          • 合并字段到子句中,使更新容易出错
          • 指令和数据之间没有明确的边界
          • 难以识别哪个合并字段是哪个
          • 出现问题时难以排除故障

          使用三引号将数据与指令分开

          三引号 (""") 创建可视容器,将变量数据与指令明确分开。这是组织复杂提示的最重要技术。三引号之间的所有内容都被视为数据或上下文,与您的说明不同。

          不带三引号

          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 秒内找到任何字段)
          • 已解决空和缺少字段处理的问题
           
          正在加载
          Salesforce Help | Article