Prompt: Can you give me a list of ideas for blog posts for tourists visiting
New York City for the first time?
ロール プロンプト:
Prompt: You are a mighty and powerful prompt-generating robot. You need to
understand my goals and objectives and then design a prompt. The prompt should
include all the relevant information context and data that was provided to you.
You must continue asking questions until you are confident that you can produce
the best prompt for the best outcome. Your final prompt must be optimized for
chat interactions. Start by asking me to describe my goal, then continue with
follow-up questions to design the best prompt.
データの編成:
Prompt: Create a four-column spreadsheet of 10 highly-rated science fiction
movies, year of release, average audience rating, and top 3 keywords from
audience reviews.
Make sure to cite the source of the audience rating.
例によるプロンプト(ワンショット、少数ショット、マルチショット)
ワンショット プロンプトは、モデルにわかりやすい説明例を示します。
それを真似したいとします
一つの例を使用したアイデアの生成:
Prompt:
Come up with a list of ideas for blog posts for tourists visiting
New York City for the first time.
1. Fuggedaboutit! Where to Stay in New York City On Your First Visit
Prompt:
Great product, 10/10: Positive
Didn't work very well: Negative
Super helpful, worth it: Positive
It doesn't work!:
このプロンプトを実行すると、モデルの応答は、「
「仕事」例に示すように、正または負の値です。
マルチショットの絵文字レスポンスの予測機能:
Prompt: Predict up to 5 emojis as a response to a text chat message. The output
should only include emojis.
input: The new visual design is blowing my mind 🤯
output: ➕,💘, ❤🔥
input: Well that looks great regardless
output: ❤️,🪄
input: Unfortunately this won't work
output: 💔,😔
input: sounds good, I'll look into that
output: 🙏,👍
input: 10hr cut of jeff goldblum laughing URL
output: 😂,💀,⚰️
input: Woo! Launch time!
Prompt:
The odd numbers in this group add up to an even number: 4, 8, 9, 15, 12, 2, 1.
A: Adding all the odd numbers (9, 15, 1) gives 25. The answer is False.
The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.
A:
Prompt:
I went to the market and bought 10 apples. I gave 2 apples to the neighbor and
2 to the repairman. I then went and bought 5 more apples and ate 1. How many
apples was I left with?
Let's think step by step.
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-08-21 UTC。"],[[["\u003cp\u003ePrompt engineering enables direct interaction with Large Language Models (LLMs) using natural language to elicit desired outputs.\u003c/p\u003e\n"],["\u003cp\u003eEffective prompting involves clear communication, structured prompts with context and instructions, and the use of examples and constraints.\u003c/p\u003e\n"],["\u003cp\u003eDifferent prompting techniques include direct, few-shot, multi-shot, and chain-of-thought prompting to cater to various task complexities.\u003c/p\u003e\n"],["\u003cp\u003eIterative prompt refinement is crucial and involves techniques like repetition, format specification, and exploring synonyms to optimize results.\u003c/p\u003e\n"],["\u003cp\u003eCreativity and persistence are essential for successful prompt engineering, especially given the evolving nature of LLMs.\u003c/p\u003e\n"]]],[],null,["# Prompt Engineering for Generative AI\n\nPrompt engineering is the art of asking the right question to get the\nbest output from an LLM. It enables direct interaction with the LLM using\nonly plain language prompts.\n\nIn the past, working with machine learning models typically required deep\nknowledge of datasets, statistics, and modeling techniques. Today, LLMs can be\n\"programmed\" in English, as well as\n[other languages](https://blog.google/products/bard/google-bard-new-features-update-july-2023/).\n| **Estimated Read Time:** 20 minutes\n| **Learning objectives:**\n|\n| - Describe basic prompting techniques.\n| - Apply prompting best practices to create effective prompts.\n\nBeing a great prompt engineer doesn't require coding experience. Creativity and\npersistence will benefit you greatly on your journey, however. Read on to\nlearn some useful prompting techniques.\n\nPrompting Best Practices\n------------------------\n\n1. Clearly communicate what content or information is most important.\n\n2. Structure the prompt: Start by defining its role, give context/input data,\n then provide the instruction.\n\n3. Use specific, varied examples to help the model narrow its focus and generate\n more accurate results.\n\n4. Use constraints to limit the scope of the model's output. This can help avoid\n meandering away from the instructions into factual inaccuracies.\n\n5. Break down complex tasks into a sequence of simpler prompts.\n\n6. Instruct the model to evaluate or check its own responses before producing\n them. (\"Make sure to limit your response to 3 sentences\", \"Rate your work on a\n scale of 1-10 for conciseness\", \"Do you think this is correct?\").\n\nAnd perhaps most important:\n\n**Be creative!** The more creative and\nopen-minded you are, the better your results will be. LLMs and prompt\nengineering are still in their infancy, and evolving every day.\n\nTypes of Prompts\n----------------\n\n### Direct prompting (Zero-shot)\n\nDirect prompting (also known as Zero-shot) is the simplest type of prompt. It\nprovides no examples to the model, just the instruction. You can also phrase the\ninstruction as a question, or give the model a \"role,\" as seen in the second\nexample below.\n\nProvide:\n\n1. Instruction\n2. Some context\n\nIdea Generation: \n\n Prompt: Can you give me a list of ideas for blog posts for tourists visiting\n New York City for the first time?\n\nRole Prompting: \n\n Prompt: You are a mighty and powerful prompt-generating robot. You need to\n understand my goals and objectives and then design a prompt. The prompt should\n include all the relevant information context and data that was provided to you.\n You must continue asking questions until you are confident that you can produce\n the best prompt for the best outcome. Your final prompt must be optimized for\n chat interactions. Start by asking me to describe my goal, then continue with\n follow-up questions to design the best prompt.\n\nData Organization: \n\n Prompt: Create a four-column spreadsheet of 10 highly-rated science fiction\n movies, year of release, average audience rating, and top 3 keywords from\n audience reviews.\n\n Make sure to cite the source of the audience rating.\n\n### Prompting with examples (One-, few-, and multi-shot)\n\nOne-shot prompting shows the model one clear, descriptive example of what\nyou'd like it to imitate.\n\nIdea generation using one example: \n\n Prompt:\n\n Come up with a list of ideas for blog posts for tourists visiting\n New York City for the first time.\n\n 1. Fuggedaboutit! Where to Stay in New York City On Your First Visit\n\nFew- and multi-shot prompting shows the model more examples of what you want it\nto do. It works better than zero-shot for more complex tasks where pattern\nreplication is wanted, or when you need the output to be structured in a\nspecific way that is difficult to describe.\n\nFew-shot sentiment classification: \n\n Prompt:\n\n Great product, 10/10: Positive\n Didn't work very well: Negative\n Super helpful, worth it: Positive\n It doesn't work!:\n\nWhen this prompt is run, the model's response will be to classify 'It doesn't\nwork' as positive or negative, as shown in the examples.\n\nMulti-shot emoji response predictor: \n\n Prompt: Predict up to 5 emojis as a response to a text chat message. The output\n should only include emojis.\n\n input: The new visual design is blowing my mind 🤯\n output: ➕,💘, ❤🔥\n\n input: Well that looks great regardless\n output: ❤️,🪄\n\n input: Unfortunately this won't work\n output: 💔,😔\n\n input: sounds good, I'll look into that\n output: 🙏,👍\n\n input: 10hr cut of jeff goldblum laughing URL\n output: 😂,💀,⚰️\n\n input: Woo! Launch time!\n\nSame process here, but since the prompt is more complex, the model has been\ngiven more examples to emulate.\n\n### Chain-of-thought prompting\n\nChain of Thought (CoT) prompting encourages the LLM to explain its reasoning.\nCombine it with few-shot prompting to get better results on more complex tasks\nthat require reasoning before a response. \n\n Prompt:\n\n The odd numbers in this group add up to an even number: 4, 8, 9, 15, 12, 2, 1.\n A: Adding all the odd numbers (9, 15, 1) gives 25. The answer is False.\n The odd numbers in this group add up to an even number: 15, 32, 5, 13, 82, 7, 1.\n A:\n\n### Zero-shot CoT\n\nRecalling the zero-shot prompting from earlier, this approach takes a zero-shot\nprompt and adds an instruction: \"Let's think step by step.\" The LLM is able to\ngenerate a chain of thought from this instruction, and usually a more accurate\nanswer as well. This is a great approach to getting LLMs to generate correct\nanswers for things like word problems. \n\n Prompt:\n\n I went to the market and bought 10 apples. I gave 2 apples to the neighbor and\n 2 to the repairman. I then went and bought 5 more apples and ate 1. How many\n apples was I left with?\n\n Let's think step by step.\n\n### Prompt iteration strategies\n\nLearn to love the reality of rewriting prompts several (possibly dozens) of\ntimes. Here are a few ideas for refining prompts if you get stuck:\n\n**Note:** These strategies may become less useful or necessary over time as\nmodels improve.\n\n1. Repeat key words, phrases, or ideas\n\n2. Specify your desired output format (CSV, JSON, etc.)\n\n3. Use all caps to stress important points or instructions. You can also try\n exaggerations or hyperbolic language; for example: \"Your explanation should be\n absolutely impossible to misinterpret. Every single word must ooze clarity!\"\n\n4. Use synonyms or alternate phrasing (e.g., instead of \"Summarize,\" try\n appending \"tldr\" to some input text). Swap in different words or phrases and\n document which ones work better and which are worse.\n\n5. Try the sandwich technique with long prompts: Add the same statement in\n different places.\n\n6. Use a prompt library for inspiration. [Prompt Hero](https://prompthero.com/)\n and this [prompt gallery](https://developers.generativeai.google/prompt-gallery)\n are two good places to start.\n\n### Additional resources\n\n[Prompting Best Practices](https://developers.generativeai.google/guide/prompt_best_practices)\n\n[Learn Prompting (external)](http://learnprompting.org)"]]