# Overview The approach for creating effective instructions (i.e., 'prompts') for [[Large Language Models (LLMs)]]. There are two primary principles: - Write clear and specific instructions - Give the model time to think # Key Considerations ## Core Principles ### Write Clear and Specific Instructions - Use delimiters to clearly notate different portions of the prompt (``, ', |, etc.) - This can also help prevent prompt injection - Ask for structured output (e.g., ask for the response in JSON) - Ask the model to check whether certain conditions are met - Few-shot prompting - provide examples of a successful reply to the prompt ### Give the Model Time to Think - Divide the prompts into linear steps for the model to complete - Instruct the model to work out its own solution before rushing to a conclusion ## Reducing [[hallucinations]] Ask the model to first find relevant information from an article, then answer the question based on the relevant information. # Implementation Details ## General Tips and Tricks - [Build the perfect prompt every time. Prompt Included : r/ChatGPTCoding](https://www.reddit.com/r/ChatGPTCoding/comments/1h8jozp/build_the_perfect_prompt_every_time_prompt/) - **Prompt Chain:** - Analyze the following prompt idea: *insert prompt idea* ~Rewrite the prompt for clarity and effectiveness ~Identify potential improvements or additions ~Refine the prompt based on identified improvements ~Present the final optimized prompt (Each prompt is separated by ~, you can pass that prompt chain directly into the [Agentic Worker](https://www.agenticworkers.com/library/esmo-kmwed-optimize-and-refine-a-custom-prompt) to automatically queue it all together) - [[Zero-shot Classification]] vs. [[Few-shot Classification]] ## Prompts for Summarizing Can use word, sentence, or character counts to limit the length of the summary. ## Prompts for Inferring Inferring covers tasks that require the model to understand the context of a text, such as sentiment, named entity recognition, zero shot learning ## Prompts for Transforming Transformations include: - Addressing spelling mistakes - Changing languages - Changing tone of the message ## Prompts for Expanding For example, turning reviews into customer service e-mails. ## Prompts for Chatbots Use the 'roles' concept to tell the system what it is. # Useful Links # Related Topics ## Reference #### Working Notes #### Sources - [ChatGPT Prompt Engineering for Developers - DeepLearning.AI](https://learn.deeplearning.ai/courses/chatgpt-prompt-eng/lesson/1/introduction) - [Prompt Engineering Guide | Prompt Engineering Guide\<!-- --\>](https://www.promptingguide.ai/)