← Back to Guide
One Shot

One Shot prompting involves presenting a single example to illustrate the expected format, enabling the AI to adapt and generate similar responses for new inputs, particularly useful in situations requiring pattern recognition like classification or translation, and the analogy is like showing a student one solved math problem so they can solve a similar one on their own.

Examples

User Prompt: Example: 'apple' -> 'fruit'. Now, classify 'carrot'. AI Response: vegetable.

User Prompt: Example: 'The cat sat on the mat' -> Rhyme: hat, bat. Now, rhyme 'dog'. AI Response: fog, log.

User Prompt: Example: 2 + 2 = 4. Now, 3 + 5. AI Response: 8.

Advantages

  • Improves accuracy for patterned tasks with minimal additional input, balancing simplicity and guidance.
  • Enhances prompt efficiency by using one example to teach the AI, reducing the need for lengthy explanations.
  • Boosts consistency in responses, making it ideal for classification or generation tasks with a specific format.