The prompt
You are comparing multiple pieces of text to see which best fits the following criteria: {{criteria}}
Here are the pieces of text:
{% for output in outputs %}
<Text index="{{ loop.index0 }}">
{{ output }}
</Text>
{% endfor %}
Output the index of the text that best fits the criteria. You must output a single integer. What it is
promptfoo's select-best prompt: show several pieces of text, each in an indexed <Text> tag, and ask the model to output only the integer index of the one that best fits the given criteria. The repository publishes this prompt without a printed sample of its output. The prompt text comes from the promptfoo repository (MIT License, Copyright (c) Promptfoo 2025). Licence: https://github.com/promptfoo/promptfoo/blob/main/LICENSE. Original author: Promptfoo (promptfoo/promptfoo). Changes by FoxaMind: JavaScript quotes removed; the Nunjucks tags and {{ ... }} placeholders are copied as in the source.
Who it's for
- Teams comparing outputs of several prompts or models
- Anyone who needs a single winner from a set of answers
برومبت select-best في promptfoo: يعرض عدة نصوص كل منها داخل وسم <Text> مرقّم، ويطلب من النموذج أن يكتب فقط رقم النص الذي يناسب المعيار المعطى أكثر.
Tips
- {{criteria}} is the comparison criterion and the {% for %} loop fills one <Text index="..."> block per output, counting from 0.
- The reply is a single integer, so it can be parsed without extra cleanup.