TOPIC AI
Few-Shot Prompting providing examples to guide the model
IN 10 SECONDS
Injecting a few examples (inputs and expected outputs) inside the prompt template to show the model the target format and style before asking the actual question.
GOTCHA Providing poor or conflicting examples inside the prompt confuses the model, degrading answer accuracy.
HOW FEW-SHOT INSTRUCTS RUN
01 Pattern examples prompt sets: 'Input: cat -> Output: feline. Input: dog -> Output: canine.'
02 Query link appends the real query: 'Input: horse -> Output:'.
03 Prediction LLM detects pattern matches and output format, generating: 'equine'.
POKE IT YOURSELF
promptfoo eval --config my-few-shot.yaml — test few-shot template accuracy
Drill this topic →
~65 sec read