Few-Shot Example Builder

Create and format few-shot examples for your LLM prompt.

A form-based editor that turns input/output example pairs into consistent few-shot prompt sections for OpenAI, Anthropic or generic styles. Add, reorder and copy your examples — everything runs in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is few-shot prompting?

Few-shot prompting gives a model a handful of worked examples (input paired with the desired output) before the real request. The examples demonstrate the format, tone and reasoning you want, letting the model imitate them without any fine-tuning. It is one of the most reliable ways to steer output quality.

Few-shot examples are the single most effective lever for shaping LLM output without fine-tuning. This builder lets you enter clean input/output pairs in a form and exports them in the exact format your API expects — OpenAI message arrays, Anthropic XML, or a generic layout.

How it works

Add one row per example: the representative input and the ideal output you want the model to learn from. Pick a target format and the tool assembles a consistent, copy-ready block:

  • OpenAI — alternating user / assistant role messages for the messages array.
  • Anthropic<example> blocks with <input> and <output> tags for Claude.
  • Generic — plain Input: / Output: pairs that work in any prompt.

All formatting happens locally. Nothing you type is uploaded.

What makes a good few-shot example

The quality of examples matters far more than the quantity. A model that sees two carefully chosen examples will consistently outperform one that sees ten near-identical ones.

Cover the shape of the task, not just one case. For a sentiment classifier, include a clearly positive example, a clearly negative one, and a genuinely ambiguous one. The ambiguous case teaches the model where the boundary lies.

Make outputs exactly the format you want. If you want JSON, write perfect JSON in the output field — every quote, brace, and key name. The model mimics what it sees, so a sloppy example teaches sloppy output.

Avoid leaking the answer in the input. If your example input says “This is a great product!” and your output says “positive,” you have taught the model an easy pattern. Include examples that require genuine inference.

Match the length of expected real inputs. A two-sentence input example followed by a paragraph of output will cause the model to be verbose when the real input is short.

Format comparison

FormatWhen to use
OpenAI (role messages)Chat completions API with messages array
Anthropic XMLSingle-turn or system prompt with Claude
Generic (Input/Output)Any prompt that does not need structured turns

Tips

Keep examples diverse — cover the easy case, a tricky edge case and the failure mode you want the model to avoid. Two to five examples is usually enough; beyond that you spend tokens for diminishing returns. Place the examples after your instruction and before the real user input so the model sees the task it must complete last. If output formatting matters (JSON, a specific schema), make every example’s output strictly conform — the model copies whatever it sees.