Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

How to make a check required in Promptfoo

An AI test can pass even when the one check you needed has failed. If you've set a minimum average in Promptfoo, open the individual check results before you trust the green row. Give the test a reply it should

An AI test can pass even when the one check you needed has failed. If you've set a minimum average in Promptfoo, open the individual check results before you trust the green row.

Give the test a reply it should fail

Suppose an incident notice must include the incident number so the reader can look up the outage. You also check for three pieces of copy the team likes to see. This example uses text checks so we can see exactly how the verdict is made.

Here's the test-case fragment with four equally weighted assertions. In Promptfoo an assertion is one check on the output.

threshold: 0.75
assert:
  - type: contains
    value: 'Incident ID: INC-42'
  - type: contains
    value: 'Status:'
  - type: contains
    value: 'Impact:'
  - type: contains
    value: 'Next update:'

Try this reply as a fixed example.

Status: Investigating. Impact: Checkout errors. Next update: 14:30 UTC.

It hits three checks out of four. That's 0.75. The case reaches the threshold even though the incident number is missing. The threshold here applies to the test case as a whole. Promptfoo scoring documentation

Give the required check its own pass condition

For this case I'd leave only the requirement that carries a release decision. Remove the case-level threshold and make sure one isn't inherited from the test defaults. This leaves a single assertion with the default weight of one. It has to pass for the case to pass. Keep the other checks in a separate quality report if the team wants to track them.

assert:
  - type: contains
    value: 'Incident ID: INC-42'

Use the same fixed reply again. The missing number should fail the case. Add Incident ID: INC-42 without changing the rest of the reply and it should pass. Keep both examples and run them when the scoring config changes. With more than one required check, include an example that fails each one on its own.

This particular check answers whether the notice includes the expected reference. If your rule is about something the agent actually did, feed the test evidence from the system that recorded the action. Nugalaxy Evaluation Cases

When someone asks why a test passed, I want to be able to point to the check the decision depended on. Give that check a visible verdict in the report. Nugalaxy harness-engineering guides

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.