# `Nous.Eval.Scorers.OutputSchema`
[🔗](https://github.com/nyo16/nous/blob/v0.21.1/lib/nous/eval/scorers/output_schema.ex#L1)

Passes when the output validates against an output type, using the same
validation the agent uses (`Nous.OutputSchema.parse_and_validate/2`).

    {Nous.Eval.Scorers.OutputSchema, schema: MyApp.Refund, values: %{"status" => "approved"}}

## Options

  * `:schema` - any `Nous.Types.output_type()` except `:string`: an Ecto
    schema module, a schemaless `%{field: type}` map, a raw JSON schema
    (string-keyed map; only the JSON is parsed, as for the agent),
    `{:choice, [..]}`, `{:regex, source}` or `{:one_of, [..]}`. Dataset
    files can give a raw JSON schema
  * `:values` - optional map of expected field values, compared as a
    recursive subset of the validated output (keys as strings, numbers
    with `==`)

Text output is parsed and validated. Structured output (the agent ran with
an `output_type`) is re-validated through its JSON form; a struct of the
schema module itself is already valid. A failed run fails with reason
`"run_failed"`; validation failure fails with
`"schema_validation_failed"` and the formatted errors in `details`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
