> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scorecards

> Version, run, and monitor table evaluations with reusable criteria, row-level results, and evidence.

Teams ship prompts quickly, then hit a quality wall. Results drift. Edge cases slip in. Regressions reach users before anyone sees the pattern.

Scorecards give a sheet a repeatable evaluation contract. You define the checks that matter, run them against rows, and review the exact failures with evidence.

## Open the scorecard panel

Open a table and click the score badge in the toolbar. The scorecard panel shows the current aggregate score, verdict, last calculation time, row evaluator status, and failing criteria.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/03-concept-scorecard-overview.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=74b389613516a562d62c09a2da710580" alt="Scorecard panel showing a 25 percent failing quality score, failing evaluators, and row evaluator summaries" width="1440" height="900" data-path="images/tables/scorecards/03-concept-scorecard-overview.png" />
</Frame>

The top score is the sheet-level result. Each evaluator contributes to that result based on its weight and thresholds. A failed required evaluator can fail the full scorecard, depending on the aggregation settings.

## Add evaluators

Click **Add evaluator** to choose how each row should be graded.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/08-criterion-add-menu.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=578dab3b142d3412ffd12358cefdea9a" alt="Add row evaluator menu with AI Judge, Code Check, Compare Values, Contains Text, Regex Match, and Valid Format options" width="1440" height="900" data-path="images/tables/scorecards/08-criterion-add-menu.png" />
</Frame>

Available evaluator types include:

| Evaluator          | Use when                                                                |
| ------------------ | ----------------------------------------------------------------------- |
| **AI Judge**       | You need rubric-based grading for subjective output quality.            |
| **Code Check**     | You need deterministic checks with custom logic.                        |
| **Compare Values** | You need expected column, numeric threshold, or JSON comparison checks. |
| **Contains Text**  | You need required words, phrases, or facts.                             |
| **Regex Match**    | You need exact pattern checks for structured strings.                   |
| **Valid Format**   | You need JSON, XML, or schema-style validation.                         |

You can also add a column summary. Column summaries run once across the whole column. Row evaluators run once per row, then roll up into the overall score.

## Configure an evaluator

Each evaluator has a name, source columns, matching rules, thresholds, and weight. In this example, **Contains Text** checks whether the `Output` column contains the expected value from another column.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/08-criterion-edit-form.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=26845bde2293d37475eba128f51b5240" alt="Edit evaluator form for a Contains Text evaluator with source column, match source, column to match, and weight" width="1440" height="900" data-path="images/tables/scorecards/08-criterion-edit-form.png" />
</Frame>

Use weights to make important checks count more. A weight of `2` counts twice as much as a standard evaluator when scores are averaged.

## Review all rows

After a calculation finishes, open **All rows** to find failures fast. Filter by verdict, search rows, then open a row to see why it failed.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/03-concept-all-rows.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=d05b7385e96f8b024921a08824ff1eb9" alt="All rows view with search, verdict filters, and row-level scorecard results" width="1440" height="900" data-path="images/tables/scorecards/03-concept-all-rows.png" />
</Frame>

Rows show score, verdict, and drift when a previous calculation is available. This makes regression review concrete. You can find the rows that changed, inspect the evidence, and decide whether to update the prompt, data, or evaluator.

## Inspect row evidence

Open a row to see the evaluated inputs, row score, failed evaluators, and per-evaluator results.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/03-concept-row-breakdown.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=2be3a0286264821d32f520b0f0bc2946" alt="Row scorecard breakdown showing evaluated inputs, a 50 percent row score, and one failed evaluator" width="1440" height="900" data-path="images/tables/scorecards/03-concept-row-breakdown.png" />
</Frame>

Expand a failed evaluator to see the result and evidence. In the example below, the expected value is `30 days`, and the comparison failed because values differ.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/03-concept-criterion-evidence.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=ae20c624ad22743e47d62b50eded6ea8" alt="Expanded evaluator evidence showing result, score, failed verdict, and evidence for a row" width="1440" height="900" data-path="images/tables/scorecards/03-concept-criterion-evidence.png" />
</Frame>

This is the core workflow for prompt iteration. Domain experts can read the row, judge whether the failure is real, and update the prompt or rubric without digging through code.

## Inspect one evaluator

Open an evaluator to see its aggregate result across rows. This view shows the average score, pass count, and each row's result for that criterion.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/03-concept-criterion-detail.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=a144429ec0ae8b9dc949c7a1df5406a1" alt="Criterion detail view showing a 50 percent average score and per-row contains text results" width="1440" height="900" data-path="images/tables/scorecards/03-concept-criterion-detail.png" />
</Frame>

Use this view when one check is noisy. If many rows fail the same evaluator, the evaluator may need a clearer rule, a better expected column, or a different threshold.

## Recalculate after changes

Editing a scorecard or changing inputs can make results stale. The panel marks the scorecard as edited and keeps the previous calculation visible until you rerun.

<Frame>
  <img src="https://mintcdn.com/promptlayer/gIS5py6rWfjutLnT/images/tables/scorecards/03-concept-stale-state.png?fit=max&auto=format&n=gIS5py6rWfjutLnT&q=85&s=89aa05a3966d2f6c80ac208493759d9f" alt="Scorecard panel showing edited state after criteria changed and results need recalculation" width="1440" height="900" data-path="images/tables/scorecards/03-concept-stale-state.png" />
</Frame>

Recalculate after you:

* Add, remove, or edit an evaluator.
* Change a source or expected column.
* Update weights or thresholds.
* Rerun cells that feed the scorecard.
* Import or edit rows in the sheet.

## API workflow

The API uses the same model as the UI.

| Step                               | Endpoint                                       |
| ---------------------------------- | ---------------------------------------------- |
| Read the current scorecard         | `GET /scorecard`                               |
| Configure criteria and aggregation | `PATCH /scorecard`                             |
| Queue a calculation                | `POST /scorecard/recalculate`                  |
| Poll calculation status            | `GET /scorecard/calculations/{calculation_id}` |
| Review row summaries               | `GET /scorecard/rows`                          |
| Inspect one row                    | `GET /scorecard/rows/{row_index}`              |
| Cancel active work                 | `POST /scorecard/cancel`                       |

For scoped work, pass `row_indices` and `step_ids` to recalculation or cancel endpoints. Row pagination uses `cursor` / `next_cursor`; row breakdown fields such as `aggregate_score`, `aggregate_verdict`, and `step_results` are returned at the top level.

## Migrate from legacy `/score`

If your sheet uses legacy scoring, migrate in place and keep current integrations stable.

1. Run `POST /scorecard/migrate-legacy-score` with `delete_legacy_score: false`.
2. Check `converted_count`, `skipped`, and generated `steps`.
3. Run `POST /scorecard/recalculate`.
4. Move consumers from `/score` to `/scorecard` endpoints.
5. Set `delete_legacy_score: true` only after migration is complete.

Some legacy score configurations cannot be converted automatically, including custom scoring code, missing score columns, and unsupported column types. Check `skipped` before deleting legacy score configuration.

## Python SDK example

```python theme={null}
from promptlayer import PromptLayer

client = PromptLayer(api_key="pl_your_key")

table_id = "00000000-0000-0000-0000-000000000000"
sheet_id = "11111111-1111-1111-1111-111111111111"

client.tables.sheets.scorecards.configure(
    table_id,
    sheet_id,
    {
        "name": "Quality Scorecard",
        "aggregation": {
            "method": "weighted_mean",
            "required_step_failure_behavior": "fail",
            "pass_threshold": 0.8,
            "warn_threshold": 0.6,
        },
        "steps": [
            {
                "title": "Output matches expected",
                "primitive_type": "COMPARE",
                "source_column_ids": ["output-column-id", "expected-column-id"],
                "weight": 1,
                "required": False,
                "thresholds": {"pass": 0.8, "warn": 0.6},
                "primitive_config": {
                    "sources": ["output-column-id", "expected-column-id"],
                },
            }
        ],
    },
)

run = client.tables.sheets.scorecards.recalculate(
    table_id,
    sheet_id,
    {"row_indices": [0, 1, 2], "step_ids": ["22222222-2222-2222-2222-222222222222"]}
)
calculation_id = run["calculation_id"]

rows = client.tables.sheets.scorecards.list_rows(
    table_id,
    sheet_id,
    {"calculation_id": calculation_id, "verdict": "fail", "limit": 50},
)

if rows["rows"]:
    row = client.tables.sheets.scorecards.get_row(
        table_id,
        sheet_id,
        rows["rows"][0]["row_index"],
        {"calculation_id": calculation_id},
    )
    print(row["aggregate_score"], row["aggregate_verdict"])
```

## API references

<CardGroup cols={2}>
  <Card title="Get scorecard" icon="clipboard-check" href="/reference/table-sheet-scorecard-get">
    Read scorecard config and display run state.
  </Card>

  <Card title="Configure scorecard" icon="sliders" href="/reference/table-sheet-scorecard-configure">
    Create or update criteria and aggregation.
  </Card>

  <Card title="Recalculate scorecard" icon="rotate" href="/reference/table-sheet-scorecard-recalculate">
    Queue full or scoped scorecard runs.
  </Card>

  <Card title="List scorecard rows" icon="table" href="/reference/table-sheet-scorecard-rows-list">
    Review row-level verdicts and drill into failures.
  </Card>
</CardGroup>
