TECHNOLOGY

Promptfoo output transforms: know which artifact your assertions actually measure

In this article
THE QUICK TAKE

An assertion judges the value it receives after transformation, which may differ from the raw provider response.

Name the artifact under evaluation

An output check may run against an extracted field rather than the full provider response. That can be exactly right for an application contract, but it must be intentional. The configuration guide describes response and test transformations. State whether the requirement concerns a raw model reply, an application envelope or a selected field. Otherwise, an improvement in parsing can be misreported as an improvement in the model’s ability to follow instructions.

Follow the transformation sequence

The documented sequence applies the provider transform before test-level transformations. Context extraction for context-based assertions also receives the provider-transformed output. Inspect these branches separately. The value checked for correctness and the retrieved material supplied to a faithfulness judge can originate from different fields. Verify that both describe the same application execution, rather than mixing a current answer with context left over from another response or a different stage of processing.

Check replacement of defaults

The test-case reference gives each case options that interact with defaults. Current transformation documentation specifies that an individual test transform overrides the default test transform instead of composing both. A case-specific extraction can therefore bypass a normalization step the author assumed always ran. Inspect representative cases with and without overrides, and preserve the realized value supplied to assertions rather than reconstructing it from a visual reading of nested configuration.

Keep extraction from becoming answer repair

The assertion guide also permits assertion-specific transforms. Selecting a structured field differs from silently correcting a wrong value or removing disallowed content. Decide which transformations belong to the actual application and which exist only in the evaluator. If raw-format compliance matters, test it before a cleanup step erases evidence of failure. Retain raw and transformed artifacts so a passing semantic check does not imply unmeasured compliance with the original output contract.

Exercise adversarially simple fixtures

Use a valid envelope, a missing field, unexpected surrounding text and an incorrect value that normalization could conceal. Check every intermediate artifact and the final verdict. The guides to CSV test compilation and solver-to-scorer state provide adjacent controls. Accept the setup when each transformation has a declared purpose and a predictable failure outcome, keeping application postprocessing separate from claims about what the model returned unaided.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles