Prompting Techniques
Chain-of-Thought Prompting
Chain-of-Thought (CoT) prompting is a technique that encourages the AI model to break down a problem into a series of intermediate steps. This helps the model to "think" through the problem and often leads to more accurate results, especially for complex reasoning tasks.
# Example: Chain-of-Thought Prompt
Q: A cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
A: The cafeteria started with 23 apples. They used 20, so they had 23 - 20 = 3 apples left. Then they bought 6 more, so they now have 3 + 6 = 9 apples. The answer is 9.
Few-Shot Prompting
Few-shot prompting involves providing the AI with a few examples of the task you want it to perform. This gives the model context and helps it to understand the desired output format and style.
# Example: Few-Shot Prompt
Translate the following English words to French:
sea -> mer
sky -> ciel
house -> maison
tree ->
Zero-Shot Prompting
Zero-shot prompting is when you ask the AI to perform a task without providing any examples. This relies on the model's existing knowledge and its ability to generalize from the vast amount of data it was trained on.
# Example: Zero-Shot Prompt
Translate "cat" to Spanish.
Hands-on Exercise
Click the link below to try a chain-of-thought prompt in the app. The prompt will be pre-filled for you.
Try this prompt