将复杂任务分解成多个较简单的提示

对于需要多个指令或步骤的复杂任务,您可以将提示分解为多个子任务,以改进模型的响应。较小的提示可以帮助您提高可控性、调试性和准确性。

您可以通过以下两种方式细分复杂的提示,并将其注入到模型中:

  • 串联提示:将任务拆分为多个子任务并按顺序运行这些子任务。
  • 汇总回答:将任务拆分为多个子任务并且并行运行这些子任务。

串联提示

对于涉及多个连续步骤的复杂任务,请将每个步骤设为一个提示,并将这些提示按顺序串联在一起。在这一连串的提示中,序列中一个提示的输出将成为下一个提示的输入。序列中最后一个提示的输出将是最终输出。

示例

例如,假设您经营一家电信公司,希望使用模型来帮助您分析客户反馈,以发现一些常见的客户问题,然后对这些问题进行分类,并为各种类别的问题生成相应的解决方案。

任务 1:发现客户问题

您希望模型完成的第一个任务是从原始客户反馈中提取有意义的数据。实现此任务的提示可能类似于以下内容,其中 CUSTOMER_FEEDBACK 是包含客户反馈的文件:

提取数据

      Extract the main issues and sentiments from the customer feedback on our telecom services.
      Focus on comments related to service disruptions, billing issues, and customer support interactions.
      Please format the output into a list with each issue/sentiment in a sentence, separated by semicolon.

      Input: CUSTOMER_FEEDBACK
    

模型给出的回答应该会包含从客户反馈中提取的问题及相应情绪的列表。

任务 2:对问题进行分类

接下来,您需要提示模型使用上一个任务的回答来将数据分类,以便您可以了解客户遇到的问题的类型。实现此任务的提示可能类似于以下内容,其中 TASK_1_RESPONSE 是上一个任务的回答:

对数据进行分类

        Classify the extracted issues into categories such as service reliability, pricing concerns, customer support quality, and others.
        Please organize the output into JSON format with each issue as the key, and category as the value.

        Input: TASK_1_RESPONSE
      

模型给出的回答应该会包含分类好的问题。

任务 3:生成解决方案

现在,您需要提示模型使用上一个任务的回答来根据分类好的问题生成切实可行的建议,以提高客户满意度。实现此任务的提示可能类似于以下内容,其中 TASK_2_RESPONSE 是上一个任务的回答:

生成建议

        Generate detailed recommendations for each category of issues identified from the feedback.
        Suggest specific actions to address service reliability, improving customer support, and adjusting pricing models, if necessary.
        Please organize the output into a JSON format with each category as the key, and recommendation as the value.

        Input: TASK_2_RESPONSE
      

模型的回答应该会包含针对每个类别的建议,这些建议旨在提升客户体验和改进服务质量,以满足我们的总体目标。

汇总回答

如果您有复杂的任务,但不需要按特定顺序执行任务,则可以运行并行提示并汇总模型的回答。

示例

例如,假设您拥有一家唱片店,并且希望使用模型来根据音乐在线播放趋势和您店面的销售数据来确定要为哪些唱片备货。

任务 1:分析数据

首先,您需要分析两个数据集,即在线播放数据和销售数据。您可以运行提示来并行完成这些任务。实现这些任务的提示可能类似于以下内容,其中 STORE_SALES_DATA 是包含销售数据的文件,STREAMING_DATA 是包含在线播放数据的文件:

任务 1a:分析销售数据

      Analyze the sales data to identify the number of sales of each record.
      Please organize the output into a JSON format with each record as the key, and sales as the value.

      Input: STORE_SALES_DATA
    

输出应该会包含每张唱片的销售数量,采用 JSON 格式。

任务 1b:分析在线播放数据

        Analyze the streaming data to provide a the number of streams for each album.
        Please organize the output into a JSON format with each album as the key, and streams as the value.

        Input: STREAMING_DATA
      

输出应该会包含每张专辑的在线播放次数,采用 JSON 格式。

任务 2:汇总数据

现在,您可以将这两个数据集中的数据汇总在一起,以便您制定采购决策。如需汇总数据,请将两个任务的输出都添加为输入。实现此目的的提示可能类似于以下内容,其中 TASK_1A_RESPONSETASK_1B_RESPONSE 是前面完成的任务的回答:

汇总销售数据和在线播放数据

        Recommend a stocklist of about 20 records based on the most sold and most streamed records.
        Roughly three quarters of the stock list should be based on record sales, and the rest on streaming.

      Input: TASK_1A_RESPONSE and TASK_1B_RESPONSE
      

输出应该会包含大约 20 张唱片的建议库存清单,该清单基于唱片销售数量和在线播放次数,其中有历史销售记录的唱片要比具有更高流媒体人气的唱片更受重视。

后续步骤