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