Jupyter code notebooks of "ChatGPT Prompt Engineering for Developers" by DeepLearning.AI and OpenAI. This short course taught by Isa Fulford (OpenAI) and Andrew Ng (DeepLearning.AI) will describe how LLMs work, provide best practices for prompt engineering, and show how LLM APIs can be used in applications for a variety of tasks, including:
- Summarizing (e.g., summarizing user reviews for brevity)
- Inferring (e.g., sentiment classification, topic extraction)
- Transforming text (e.g., translation, spelling & grammar correction)
- Expanding (e.g., automatically writing emails)
A prompt contains any of the following elements:
- Instruction - a specific task or instruction you want the model to perform
- Context - external information or additional context that can steer the model to better responses
- Input Data - the input or question that we are interested to find a response for
- Output Indicator - the type or format of the output.
Zero-shot prompting:
Zero-shot prompting is like giving your friend a puzzle without telling them the answer. You provide a hint or question, and even if they haven't seen it before, they can use their knowledge to figure out the solution.
Few-shot prompting:
Few-shot prompting is similar to having a few examples or clues to help your friend understand a topic better. It's like showing them a small set of similar puzzles before tackling a new one, making it easier to grasp.
Chain-of-thought prompting:
Chain-of-thought prompting is connecting ideas like building blocks. Imagine explaining a story step by step, with each part linking to the next. It's like telling a friend a series of events, helping them follow your thoughts in a logical order.
Self-consistency prompting:
Self-consistency prompting is about making sure your explanations make sense and don't contradict each other. It's like telling your friend a story and making sure the characters and events stay true to the rules you set, creating a world that's logical and believable.
ReAct prompting:
ReAct prompting is a bit like having a conversation where you respond to your friend's questions. Instead of just providing information, you adjust your explanations based on what your friend is curious about. It's like tailoring your answers to fit their interests and questions.