> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/configure-an-evaluator.md).

# Configure an evaluator

An evaluator scores a workflow response against a rule or a model-based assessment. Choose the method that measures the behavior you need to check.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FrOsY0QHPPXyDA0yHAbPJ%2FG082.mp4?alt=media&token=0293bdbe-4b00-4925-89f5-d69bc476fc68>" %}

## Before you start

Write down the behavior you want to measure and prepare at least one known good and one known bad response. If the method compares against an expected answer, prepare a reviewed [dataset](https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/create-an-evaluation-dataset.md). Separate factual correctness, completeness, and style into clear criteria rather than relying on a vague “good answer” rule.

## Configure a rule evaluator

Open Evals → Evaluators → New evaluator and choose the evaluation method.

![New evaluator method selection](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/5TKP5JQyQyS2wo2RKkSN/assets/g082-g082-01-rule.png)

For exact comparisons, select Rule and Exact match.

Use Prefill from a dataset to load a case, then inspect its Input and Expected values.

![Dataset-prefilled Input and Expected fields](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/o6J2cMIL0IaogBV9bkRu/assets/g082-g082-02-prefill.png)

Confirm that they represent the comparison you intend to perform.

## Check matching and nonmatching outputs

Provide an output that matches the expected value and run the evaluator on the sample.

![Matching-output evaluator test](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/BGLPcYNzOAD8x2jM1Z7U/assets/g082-g082-03-pass.png)

Inspect the score and decision to confirm how a match is handled.

Change the supplied output while keeping the expected value fixed and rerun the evaluator.

![Nonmatching-output evaluator test](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/SmIfJTzeflKTM736Ab7C/assets/g082-g082-04-fail.png)

This shows how the rule handles a mismatch.

## Save the evaluator

Create the evaluator after reviewing its behavior.

![Saved evaluator configuration](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/djDQiAMcbvAkpO0z1RLz/assets/g082-g082-05-saved.png)

Confirm that the saved method and expected-output reference are correct.

## Choose an LLM-based evaluator when needed

Review LLM judge templates when the task needs a model-based judgment.

![LLM judge templates](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/UOHxmNFHXgiFiQY43lim/assets/g082-g082-06-judge.png)

Methods that require a reference answer cannot be used where production monitoring has no expected output.

## Choose the method for your question

| What you need to check                                                     | Starting point                                                   | Expected answer needed?                        |
| -------------------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------- |
| An exact label or fixed output                                             | Rule → Exact match                                               | Yes                                            |
| Whether an answer addresses a stated requirement despite different wording | LLM judge → Meets criteria                                       | No, when the prompt uses only input and output |
| Whether facts agree with an approved reference                             | LLM judge → Factuality                                           | Yes                                            |
| Whether a response meets a criterion that can be judged from the output    | A reference-free LLM judge template, customized to the criterion | No                                             |

A reference-free judge can assess the information it receives. It cannot establish facts against a company policy that you have not supplied. Keep human-reviewed examples and inspect the judge's explanations before relying on its scores.

## Build a reference-free answer-quality judge

1. Open **Evals → Evaluators → New evaluator**, choose **LLM judge**, and start from **Meets criteria**. Give it a name describing the behavior, such as “Answers every part of the request.”
2. Select the judge model and retain the `{{input}}` and `{{output}}` fields in its prompt. Do not add `{{expected_output}}` when this evaluator will monitor production.
3. Replace the criterion with a specific rule. For example: “The answer addresses every requested item. When information is missing, it identifies the missing information and asks a relevant follow-up instead of inventing an answer. A partial answer without that explanation fails.”
4. Select **Pass / Fail** for the rating. Pass is 100% and Fail is 0%. If you choose custom ratings later, define each label and its value so higher scores consistently mean better performance.
5. Test a known good and known bad output using the same input. For “Summarize the document and list the required next steps,” a response that includes both a summary and the required next steps should pass this completeness rule. A response that supplies only the summary without addressing next steps should fail. Use a document your reviewers know well for the actual test.
6. Inspect the returned label, score, and explanation. If the judge disagrees with your human review, clarify the criterion or examples and test again before saving. This example tests completeness, not whether the summary and next steps are factually correct.
7. Create the evaluator and reopen it to confirm the prompt, model, and rating. Use [Run and inspect an experiment](https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/run-and-inspect-an-experiment.md) to score a reviewed dataset, or [Production quality monitors](https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/production-quality-monitors.md) to sample production responses.

LLM judges make model-based assessments. Review disagreements and periodically compare their decisions with human judgments, especially after changing the workflow or evaluator.

## Important behavior

Exact Match checks whether the values match according to that rule. It does not judge whether two differently worded answers have the same meaning.

An evaluator that requires a reference answer needs that answer in each evaluated record. Choose a suitable method when production requests have no reference answer.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/configure-an-evaluator.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
