Nekonote Toolbox logo

Nekonote Toolbox

Free browser-based tools for developers and IT admins.

日本語

Few-Shot Example Selector

Paste your candidate few-shot examples and the prompt you want to send. The selector ranks the examples by word overlap with the prompt, keeps the best ones that fit a token budget, and builds the final prompt for you.

Selection

About this tool

When a prompt includes few-shot examples, every example costs tokens. This tool simulates a common dynamic few-shot strategy: score each candidate by how many of the test prompt’s words it shares, take the highest-scoring examples first, and stop adding examples when the token budget or the maximum count is reached. An example that is too big for the remaining budget is skipped, and smaller ones after it can still be added.

The relevance score is a simple word-overlap measure and the token count is an estimate. For production use, a tokenizer for your model and embedding-based similarity search are more accurate. Everything runs in your browser; your prompts and examples are never sent to a server.

How it works

  • Relevance = the share of the test prompt’s distinct words (letters and digits, case-insensitive) that also appear in the example. With “Ignore common words” on, a short list of English function words is left out of both sides, so “the” and “to” do not create matches. Languages written without spaces between words are matched as whole runs of characters, so use the CJK estimate with care.
  • Selection: examples are sorted by relevance, with ties kept in your original order, then taken one by one while they fit in the budget. The budget is the token limit minus the estimated tokens of the test prompt. Examples left out are listed below the selected ones with the reason (over budget, or maximum count reached).
  • Token estimate is characters divided by 4, 3 or 2 (rounded up, at least 1 per line), depending on your choice. It is only a rough guide and varies by model and language.
  • Final prompt is the selected examples (in the order you choose), a blank line, then your prompt label and test prompt, then the answer label for the model to complete. The labels are editable.
  • The tool never calls a model. It only helps you decide which examples to include and what the assembled prompt looks like.

FAQ

Q. Why was a highly relevant example not selected?

A. It probably did not fit the remaining budget. Raise the token budget, shorten the example, or lower the max count so that the budget goes to the best matches.

Q. How many tokens does my model really count?

A. Use your provider’s tokenizer or token-counting tool for exact numbers. This page uses a character-based estimate so that it works for any model without sending your text anywhere.

Q. Should the best example go first or last?

A. Many people put the most relevant example last, closest to the question, but results vary by model. Try both orders on your own evaluation set.