examples/eval-max-score-selection/README.md
You can run this example with:
npx promptfoo@latest init --example eval-max-score-selection
cd eval-max-score-selection
This example demonstrates the max-score assertion type for objective output selection based on aggregated scores from other assertions.
The max-score assertion provides a deterministic way to select the best output from multiple providers by:
select-best- type: max-score
value:
method: average # 'average' (default) or 'sum'
weights:
python: 3 # Weight for Python code correctness tests
llm-rubric: 1 # Weight for LLM-evaluated quality rubrics
javascript: 2 # Weight for JavaScript tests
contains: 0.5 # Weight for simple string matching
threshold: 0.7 # Optional minimum score threshold
average (default): Weighted average of assertion scoressum: Weighted sum of assertion scores# Run the main example (requires API keys for OpenAI/Anthropic)
npx promptfoo@latest eval
Given three outputs with these assertion results:
With weights: python=3, llm-rubric=1
Use max-score when:
Use select-best when: