# DeepLearning.AI - ChatGPT Prompt Engineering for Developers (Notes) ## Metadata **Status**:: #x **Zettel**:: #zettel/fleeting **Created**:: [[2023-04-29]] **URL**:: [learn.deeplearning.ai](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/1/introduction) **Topic**:: [[♯ AI Assistant]] ## Guidelines [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/2/guidelines) ### Principle 1: Write clear and specific instructions - Tactic 1: Use delimiters to clearly indicate distinct parts of the input - Delimiters can be anything like: triple quotes `"""`, triple backticks, triple dashes `---`, angle brackets `<text here>`, or XML tags `<tag></tag>`. - Tactic 2: Ask for a structured output - JSON, HTML - Tactic 3: Ask the model to check whether conditions are satisfied - Related: [[Dair.ai Authors - Prompt Engineering Guide - 1.4 General Tips for Designing Prompts (Highlights)#^513892117]] - If you don't know, say "I don't know". - Tactic 4: "Few-shot" prompting ### Principle 2: Give the model time to “think” - Tactic 1: Specify the steps required to complete a task - Ask for output in a specified format ``` Use the following format: Text: <text to summarize> Summary: <summary> Translation: <summary translation> Names: <list of names in Italian summary> Output JSON: <json with summary and num_names> ``` - Tactic 2: Instruct the model to work out its own solution before rushing to a conclusion ## Iterative [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/3/iterative) - Try something, analyze result, clarify instructions. ## Summarizing [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/4/summarizing) - Try "extract" instead of "summarize" to avoid noises. ## Inferring [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/5/inferring) - Avoid hallucination #prompt > If the information isn't present, use "unknown" as the value. - Trick to eliminate noises #prompt > Make your response as short as possible. - Add multiple tasks and ask for a JSON response. ## Transforming [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/6/transforming) - Translate - Change Tone - Spell check #prompt > Proofread and correct the following text. - Example to avoid the quotation marks #prompt > Don't use any punctuation around the text. - Redlines #python ^readlines `Redlines` produces a Markdown text showing the differences between two strings/text. The changes are represented with strike-throughs and underlines, which looks similar to Microsoft Word's track changes. This method of showing changes is more familiar to lawyers and is more compact for long series of characters. - APA style #prompt > Make it more compelling. Ensure it follows APA style guide and targets an advanced reader. ## Expanding [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/7/expanding) - Use as a brainstorming partner. ## Chatbot [](https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/8/chatbot)