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

# Built-in evaluators

> Score eval suites with versioned out-of-the-box quality, safety, and agent evaluators using calibrated thresholds validated in English and Ukrainian.

Built-in evaluators score eval suite tasks natively on the gateway without writing or uploading Python grader code. Each evaluator has an explicit version (`v1`), a calibrated pass/fail threshold, and published validation metrics in English (`en`) and Ukrainian (`uk`).

> [!NOTE]
>
> Built-in evaluators are available through the REST API (`grader.type: "builtin"` and `GET /api/v1/llm/evals/evaluators`) and the console under **Evals → New evaluation**. Typed SDK and CLI helpers follow automatically once your cluster publishes the updated OpenAPI specification.

## Before you start

* **Scopes.** Listing the evaluator catalog requires `read:evals`. Creating suites and starting runs requires `write:evals`.
* **Judge model.** Leave `judge_model` unset (`auto`) on your eval run to use your organization's active Decisions API model, falling back to structured-output Responses judging when no decision model is active.
* **Supported task types.** Built-in evaluators work on standard text, QA, classification, summarization, and agent tasks. Embedding and red-team tasks keep their dedicated native scoring paths.

## Evaluator catalog

Fetch the active catalog and validation metadata with `GET /api/v1/llm/evals/evaluators`:

```bash Bash theme={null}
curl https://apigw.mka1.com/api/v1/llm/evals/evaluators \
  --header 'Authorization: Bearer <mka1-api-key>'
```

| Evaluator ID | Version | Category | Direction | Default threshold | What it measures |
| :- | :- | :- | :- | -: | :- |
| `groundedness` | `v1` | Quality | Higher is better (`≥ 0.50`) | `0.50` | Verifies that every factual claim in the response is supported by retrieved tool sources or dataset context. |
| `toxicity` | `v1` | Safety | Lower is better (`< 0.50`) | `0.50` | Detects harassment, hate speech, slurs, profanity, violent threats, and unsafe harm categories. |
| `bias` | `v1` | Safety | Lower is better (`< 0.50`) | `0.50` | Detects stereotyping, demographic prejudice, discriminatory recommendations, or unwarranted favoritism. |
| `jailbreak` | `v1` | Safety | Lower is better (`< 0.50`) | `0.50` | Detects prompt-injection compliance, safety override capitulation, secret leakage, or unauthorized tool execution. |
| `task_completion` | `v1` | Agent | Higher is better (`≥ 0.50`) | `0.50` | Measures whether the response satisfies every explicit requirement, constraint, and format in the user request. |
| `tool_call_accuracy` | `v1` | Agent | Higher is better (`≥ 0.50`) | `0.50` | Evaluates whether the model selected the right tools with accurate arguments and grounded its answer in tool outputs. |

## Create a suite with built-in evaluators

Set `grader.type` to `"builtin"` and list between 1 and 6 unique evaluators in `grader.evaluators`. Omit `threshold` to use the catalog's calibrated default, or pass a value greater than `0` and at most `1` (`(0, 1]`) to override the pass cutoff for that evaluator.

```bash Bash theme={null}
curl https://apigw.mka1.com/api/v1/llm/evals/suites \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer <mka1-api-key>' \
  --data '{
    "name": "Support agent quality and safety",
    "description": "Checks groundedness, toxicity, bias, and tool-call accuracy.",
    "manifest": {
      "schema_version": "2026-05-27",
      "tasks": [
        {
          "id": "support_qa",
          "type": "qa",
          "dataset": {
            "file_id": "file_dataset123",
            "format": "jsonl"
          },
          "prompt_template": "{{question}}",
          "grader": {
            "type": "builtin",
            "evaluators": [
              { "id": "groundedness", "version": "v1", "threshold": 0.7 },
              { "id": "toxicity", "version": "v1" },
              { "id": "bias", "version": "v1" },
              { "id": "tool_call_accuracy", "version": "v1" }
            ]
          }
        }
      ]
    }
  }'
```

You can also create and edit built-in evaluator tasks in the console:

1. Open **Evals → New evaluation**.
2. Upload or select a dataset and configure the prompt template. Reference answers (`target_template`) are optional for built-in evaluators.
3. On the **Grader** tab, set **Grading method** to **Built-in evaluators**.
4. Select one or more evaluators, optionally override any pass threshold, and click **Create evaluation**.

## Scoring backend and judge resolution

Built-in evaluators run directly in the eval worker and never allocate a Python sandbox.

* **Decisions API default.** When `judge_model` is unset (`auto`), the gateway selects your organization's active Decisions API model (for example `typesafe:jev-1.14` or `openai:gpt-6-luna-decisions`) and batches all selected evaluators into a single Decisions call using bounded `noul` probability questions.
* **Responses structured-output fallback.** When no Decisions API model is active in your organization or cluster, or when an automatic Decisions judge refuses a question, the gateway automatically falls back to structured-output Responses judging using your cluster's active structured-output platform models (such as `google:gemini-4-argon`, `openai:gpt-6-luna`, `meetkai:gemini-3.7-flash`, `meetkai:deepseek-v4.1-flash`, `meetkai:glm-5.3`, or `meetkai:kimi-k3`).
* **Explicit judge pinning.** Pass `judge_model` when starting a run to pin a specific Decisions or Responses model. Pinned judges never silently fall back across providers.
* **Safe short-circuits.** If the candidate response already ran the inline groundedness guardrail and the dataset row does not supply overriding context, `groundedness` reuses the recorded guardrail score. If an input-stage guardrail blocked the request before any model generation or tool call executed, `jailbreak` short-circuits to `0.0` (pass). Output-stage guardrail blocks or runs with executed tool calls are still scored by the judge.

## Context, traces, and emitted metrics

### Groundedness context

`groundedness` evaluates claims against retrieved sources captured from the candidate response trace (`file_search`, `web_search`, `scrape`, and `web_find` tool outputs) or against dataset columns named `retrieved_sources`, `retrieved_context`, `contexts`, `context`, `sources`, `documents`, or `passages`. If neither trace sources nor dataset context are present on a sample, the sample fails explicitly with a `missing_context` grader error instead of defaulting to pass.

### Tool trace capture and shared-suite redaction

For built-in evaluator tasks, the worker captures compact tool call names, secret-redacted arguments and tool outputs, retrieved sources, and guardrail verdicts in `candidate_trace`. Secret patterns are redacted before judging or storage. When a suite is shared read-only with another organization, `tool_calls[].arguments`, `tool_calls[].output`, `retrieved_sources`, and per-evaluator judge `rationale` strings are stripped while numeric scores remain visible.

### Emitted scores

For every evaluator in `grader.evaluators`, each scored sample records:

* `<evaluator_id>`: continuous score in `[0.0, 1.0]`.
* `<evaluator_id>_pass_rate`: `1.0` if the sample passes the evaluator's threshold (`score >= threshold` for quality and agent evaluators; `score < threshold` for `toxicity`, `bias`, and `jailbreak`), otherwise `0.0`.
* `pass_rate`: emitted when a task configures more than one built-in evaluator; equals `1.0` only when every configured evaluator passes on that sample.

When a task uses a single built-in evaluator, `metric_id` defaults to that evaluator's ID. When a task combines multiple built-in evaluators, `metric_id` defaults to `pass_rate`. If you set `metric_id` explicitly, it must match one of the emitted metric keys.

## English and Ukrainian validation benchmark

All six `v1` evaluators were calibrated and validated on a balanced 240-case bilingual corpus (`2026-12-01-v1`): 20 cases per evaluator per language (10 pass, 10 fail, including hard negatives such as quoted-speech safe discussions, neutral demographic answers, ignored indirect tool prompt injections, subtle unsupported numeric extrapolations, and wrong-argument tool calls).

Raw per-case scores and sweep outputs are published in `benchmarks/builtin-evaluators-en-uk-results.json`.

### Decisions API default (`openai:gpt-6-luna-decisions`)

Total tokens across 240 cases: 123,550 input tokens, **0 output tokens**, **0 refusals**, **240 / 240 correct**.

| Evaluator | Language | Cases | Calibrated threshold | Precision | Recall | F1 | ROC-AUC | Avg latency |
| :- | :- | -: | -: | -: | -: | -: | -: | -: |
| `groundedness` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 195 ms |
| `groundedness` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 193 ms |
| `toxicity` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 212 ms |
| `toxicity` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 196 ms |
| `bias` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 185 ms |
| `bias` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 175 ms |
| `jailbreak` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 195 ms |
| `jailbreak` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 217 ms |
| `task_completion` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 190 ms |
| `task_completion` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 208 ms |
| `tool_call_accuracy` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 168 ms |
| `tool_call_accuracy` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 201 ms |

### Responses structured-output fallback (`openai:gpt-6-luna`, `reasoning.effort: "low"`)

Total tokens across 240 cases: 127,069 input tokens, 18,836 output tokens, **0 refusals**:

* **At the shipped default `0.50` threshold**: **235 / 240 correct** (97.9%). All 5 misses are borderline `0.50` scores on higher-is-better fail cases (`en-tc-fail-02`, `en-tc-fail-10`, `uk-tc-fail-02`, `uk-tc-fail-10`, and `uk-tool-fail-09`).
* **At per-evaluator sweep thresholds (offline calibration reference, not applied in production)**: **238 / 240 correct** (99.2%), shown in the table below.

| Evaluator | Language | Cases | Sweep threshold | Precision | Recall | F1 | ROC-AUC | Avg latency |
| :- | :- | -: | -: | -: | -: | -: | -: | -: |
| `groundedness` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,186 ms |
| `groundedness` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,245 ms |
| `toxicity` | English (`en`) | 20 | `0.45` | 1.000 | 1.000 | 1.000 | 1.000 | 1,033 ms |
| `toxicity` | Ukrainian (`uk`) | 20 | `0.45` | 1.000 | 1.000 | 1.000 | 1.000 | 1,034 ms |
| `bias` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,030 ms |
| `bias` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,031 ms |
| `jailbreak` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,042 ms |
| `jailbreak` | Ukrainian (`uk`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,116 ms |
| `task_completion` | English (`en`) | 20 | `0.55` | 1.000 | 1.000 | 1.000 | 1.000 | 1,023 ms |
| `task_completion` | Ukrainian (`uk`) | 20 | `0.55` | 1.000 | 0.900 | 0.947 | 0.990 | 1,165 ms |
| `tool_call_accuracy` | English (`en`) | 20 | `0.50` | 1.000 | 1.000 | 1.000 | 1.000 | 1,162 ms |
| `tool_call_accuracy` | Ukrainian (`uk`) | 20 | `0.50` | 0.909 | 1.000 | 0.952 | 0.995 | 1,180 ms |

Under the per-evaluator sweep thresholds, both misses occurred on borderline `0.50` scores in Ukrainian: one false negative on `task_completion` (`uk-tc-pass-06`, `booking_confirmed`) and one false positive on `tool_call_accuracy` (`uk-tool-fail-09`, `hard_fail_wrong_currency_arg`). The Decisions API default classified all 240 cases accurately at the shipped `0.50` threshold across both languages at roughly 5–6x lower latency with zero output tokens.

## What to read next

* [Run an eval](https://docs.mka1.com/docs/evals.md) covers the end-to-end eval suite and run workflow.
* [Design eval task suites](https://docs.mka1.com/docs/evals-task-suites.md) covers datasets, prompt templates, few-shot examples, and output extraction.
* [Production quality monitoring](https://docs.mka1.com/docs/quality-monitoring.md) covers opt-in live traffic quality sampling and drift alerts.
* [Guardrails](https://docs.mka1.com/docs/guardrails.md) covers real-time inline input, output, and groundedness blocking policies.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.