﻿# Promptfoo output transforms: know which artifact your assertions actually measure

Audit Promptfoo provider, test and assertion transforms, including default overrides and extracted context, so preprocessing does not silently change the evaluated requirement.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-promptfoo-output-transform-hierarchy-measured-artifact/
Language: en

## 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](https://www.promptfoo.dev/docs/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](https://www.promptfoo.dev/docs/configuration/test-cases/) 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](https://www.promptfoo.dev/docs/configuration/expected-outputs/) 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](/journal/fg2-promptfoo-csv-expected-assertion-language/) and [solver-to-scorer state](/journal/fg2-inspect-solver-state-scorer-target-boundary/) 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.
