如果複雜任務需要多項指令或步驟,你可以將提示拆解成子任務,藉此改善模型的回覆。縮短提示可提高可控性、偵錯和準確度。
您可以透過下列兩種方式分解複雜的提示,並將其輸入模型:
- 串連提示:將工作拆解為子工作,然後依序執行。
- 匯總回覆:將工作拆分成子工作,並行執行子工作。
鏈結提示
對於涉及多個連續步驟的複雜工作,請將每個步驟變成一個提示,並將提示串連在一起。在提示的連續鏈結中,序列中一個提示的輸出內容會成為下一個提示的輸入內容。序列中最後一個提示的輸出內容就是最終輸出內容。
範例
舉例來說,假設您經營電信業務,並想使用模型分析顧客意見回饋,找出常見的顧客問題、將問題分類,以及為各類問題產生解決方案。
工作 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_RESPONSE 和 TASK_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 張唱片的清單,並優先列出銷售記錄良好的唱片,而非串流次數較多的唱片。
後續步驟
- 在提示庫中探索提示範例。