提示設計是指建立提示,從語言模型中提取所需回應的程序。撰寫結構良好的提示,是確保語言模型提供準確且高品質回覆的重要環節。本頁面將介紹一些基本概念、策略和最佳做法,協助您開始設計提示。
什麼是提示
提示是提交給語言模型的自然語言要求,用於接收回覆。提示可以包含問題、操作說明、背景資訊、範例和部分輸入內容,以便模型完成或繼續。模型收到提示後,可根據使用的模型類型產生文字、嵌入、程式碼、圖片、影片、音樂等內容。
提示內容類型
提示可包含下列一或多種類型的內容:
輸入
輸入內容是指您希望模型提供回覆的提示中文字,也是必要的內容類型。輸入內容可以是模型回答的問題 (問題型輸入內容)、模型執行的任務 (任務型輸入內容)、模型操作的實體 (實體型輸入內容),或是模型完成或繼續編寫的不完整輸入內容 (補完型輸入內容)。
輸入問題
問題輸入內容是您向模型提出的問題,模型會提供答案。
What's a good name for a flower shop that specializes in selling bouquets of dried flowers? Create a list of 10 options with just the names. Here are 10 names for a flower shop specializing in dried flowers: 1. Everlasting Blooms 2. Dried & Delightful 3. The Petal Preserve 4. Whispers of Wildflowers 5. Forever Blooms 6. The Botanical Muse 7. Timeless Blooms 8. Dried Flower Co. 9. Bloom & Co. 10. The Sun-Kissed Petals |
工作輸入內容
任務輸入內容是指您希望模型執行的任務。例如,您可以要求模型提供構想或建議。
Give me a simple list of just the things that I must bring on a camping trip. The list should have 10 items. Here's a list of 10 essential items for a camping trip: 1. **Tent:** Your shelter from the elements. 2. **Sleeping Bag:** Stay warm and comfortable. 3. **Sleeping Pad:** Insulation and cushioning for a good night's sleep. 4. **Headlamp or Flashlight:** Light for nighttime activities. 5. **First Aid Kit:** Be prepared for minor injuries. 6. **Water Bottle/Hydration Pack:** Stay hydrated. 7. **Food and Snacks:** Fuel for your adventures. 8. **Cooking Gear:** Camp stove, fuel, utensils, etc. 9. **Knife and Multitool:** Essential for various tasks. 10. **Camp Chair:** Enjoy your campfire and meals comfortably. |
實體輸入
實體輸入內容是模型執行動作的對象,例如分類或摘要。這類輸入內容可透過加入指示來發揮效用。
Classify the following items as [large, small]. Elephant Mouse Snail Here's the classification: * **Elephant:** Large * **Mouse:** Small * **Snail:** Small |
完成輸入
補完型輸入內容是指模型預期要完成或繼續編寫的文字。
Complete the following prompt: Some simple strategies for overcoming writer's block include... Some simple strategies for overcoming writer's block include: * **Freewriting:** Write non-stop for a set amount of time (5-10 minutes) without worrying about grammar, spelling, or even making sense. Just keep your pen moving and let your thoughts flow freely. This can help you loosen up and access ideas you might not have considered otherwise. * **Brainstorming:** Make a list of everything that comes to mind related to your topic, no matter how silly or unrelated it seems. You can also use mind mapping or other visual brainstorming techniques. * **Changing your environment:** Sometimes a change of scenery can be all you need to get the creative juices flowing. Go for a walk, work in a coffee shop, or even just move to a different room in your house. * **Reading:** Immerse yourself in the work of other writers, especially those who inspire you. Pay attention to their style, their structure, and their use of language. * **Taking a break:** Sometimes the best way to overcome writer's block is to simply step away from the project for a while. Go for a walk, watch a movie, listen to music, or do something else that you enjoy. You might be surprised at how much clearer your head feels when you return to your writing. * **Focusing on a single element:** Instead of tackling the entire project, focus on a single sentence, paragraph, or scene. Once you get something down on paper, it can be easier to build from there. * **Starting with the ending:** If you're stuck on the beginning, try writing the ending first. This can help you to clarify your overall vision for the project and provide a framework for your ideas. * **Talking it out:** Share your ideas and challenges with a friend, a writing group, or a writing coach. Discussing your project with someone else can help you to see it from a new perspective and find solutions to your writing problems. Remember, writer's block is a common experience, and it's not a sign that you're a bad writer. Just be patient with yourself, try some of these strategies, and keep writing! |
背景資訊
全貌可以是下列任一值:
- 指示模型應如何運作。
- 模型用來產生回覆的資訊。
如需向模型提供資訊,或將回覆範圍限制在提示範圍內,請在提示中加入背景資訊。
Marbles: Color: red Number: 12 Color: blue Number: 28 Color: yellow Number: 15 Color: green Number: 17 How many green marbles are there? There are 17 green marbles. |
範例
範例是您在提示中加入的輸入/輸出組合,用於提供模型理想回應的範例。在提示中加入範例,是調整回覆格式的有效策略。
Classify the following. Options: - red wine - white wine Text: Chardonnay The answer is: white wine Text: Cabernet The answer is: red wine Text: Moscato The answer is: white wine Text: Riesling The answer is: The answer is: white wine |
後續步驟
- 現在您已瞭解提示設計,接下來請嘗試使用 Google AI Studio 自行撰寫提示。
- 如要進一步瞭解如何設計提示,請參閱「提示策略」主題。
- 如要瞭解多模態提示,請參閱「使用媒體檔案發出提示」。