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

# Evaluation sets

Use the GraphQL API to create evaluation sets, run them, and read the results. Evaluation sets use the same endpoint and API key authentication as the rest of the GraphQL API.

> [!NOTE]
>
> The WisdomAI SDK does not support evaluation sets. To manage evaluation sets in the WisdomAI UI instead, see [Use Evaluations Sets and Runs](https://docs.wisdom.ai/improve-wisdom-ai-responses/use-evaluations-sets-and-runs.md).

## Create, run, and read results

The caller needs evaluation permissions on the domain. See [Permissions](#permissions).

**1. Get a token**

Exchange your access key for a JWT token. See [Exchange Access Token](https://docs.wisdom.ai/integrations/graphql-api/queries/auth/exchange-access-token.md) for details.

```bash theme={null}
curl -X POST https://{ACCOUNT}.askwisdom.ai/graphql \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query ExchangeAccessToken($accessToken: String!) { exchangeAccessToken(accessToken: $accessToken) }",
    "variables": { "accessToken": "<access_key>" }
  }'
```

**2. Create an evaluation set**

Send the token in the `Authorization` header. Every other request on this page uses the same endpoint and headers, so the steps below show only the GraphQL operation and its variables.

```bash theme={null}
curl -X POST https://{ACCOUNT}.askwisdom.ai/graphql \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <jwt_token>" \
  -d '{
    "query": "mutation CreateEvalSet($input: CreateEvalSetInput!) { createEvalSet(input: $input) { id caseIds } }",
    "variables": {
      "input": {
        "name": "Revenue questions",
        "domainId": "domain_987654321",
        "items": [[{
          "prompt": "What is the total revenue for closed won opportunities?",
          "sql": ["SELECT SUM(amount) FROM Opportunity WHERE stage = '\''Closed Won'\''"]
        }]]
      }
    }
  }'
```

See [createEvalSet](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/create-eval-set.md).

**3. Run it**

```graphql theme={null}
mutation RunEvaluation($domainId: String!, $existingEvalSetId: String!) {
  runEvaluation(domainId: $domainId, existingEvalSetId: $existingEvalSetId)
}
```

The mutation returns a run group ID. See [runEvaluation](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/run-evaluation.md).

**4. Get the runs**

```graphql theme={null}
query EvaluationRunGroup($runGroupId: ID!) {
  evaluationRunGroup(runGroupId: $runGroupId) {
    runs {
      id
      completedAt
      overallCombinedScore
    }
  }
}
```

See [evaluationRunGroup](https://docs.wisdom.ai/integrations/graphql-api/queries/evaluation/evaluation-run-group.md).

**5. Read the results**

Pass a run ID to [evaluationRun](https://docs.wisdom.ai/integrations/graphql-api/queries/evaluation/evaluation-run.md) to get the score and result for each turn.

## Optional features

* **Drafts:** Pass `draftId` to `createEvalSet` to stage the set on a domain draft, or to `runEvaluation` to run against the draft version of the domain.
* **Selected cases:** Pass `evaluationCaseIds` to `runEvaluation` to run only some cases. Use the IDs from `caseIds` on the evaluation set.
* **Custom grading:** Set `customGradingInstructions` on the set, or `gradingInstructions` on a turn. Add `assertions` to a turn to grade plain-language criteria.
* **Scheduling:** Use [scheduleEvalSet](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/schedule-eval-set.md) to run a set on a cron schedule, and [pauseScheduledEval](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/pause-scheduled-eval.md) to pause it.
* **Locking:** Use [setEvalSetLocked](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/set-eval-set-locked.md) to lock a set against changes.

## Permissions

These permissions typically match write access to the domain.

| Permission | Allows |
| :- | :- |
| `evaluation:read` | View evaluation sets and evaluation runs. |
| `evaluation:write` | Create, update, delete, and run evaluation sets. |
| `evaluation:schedule` | Schedule evaluation sets and pause their schedules. |
| `evaluation:lock` | Lock and unlock evaluation sets. Also required to update, delete, reschedule, or pause the schedule of a locked evaluation set. |

## Operations

| Operation | Description | Permission |
| :- | :- | :- |
| [evalSets](https://docs.wisdom.ai/integrations/graphql-api/queries/evaluation/eval-sets.md) | Returns the evaluation sets of a domain. | `evaluation:read` |
| [evaluationRuns](https://docs.wisdom.ai/integrations/graphql-api/queries/evaluation/evaluation-runs.md) | Lists evaluation runs. | `evaluation:read` |
| [evaluationRun](https://docs.wisdom.ai/integrations/graphql-api/queries/evaluation/evaluation-run.md) | Returns one run with the result for each turn. | `evaluation:read` |
| [evaluationRunGroup](https://docs.wisdom.ai/integrations/graphql-api/queries/evaluation/evaluation-run-group.md) | Returns the runs that one `runEvaluation` call started. | `evaluation:read` |
| [createEvalSet](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/create-eval-set.md) | Creates an evaluation set. | `evaluation:write` |
| [updateEvalSet](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/update-eval-set.md) | Updates an evaluation set and replaces its sessions. | `evaluation:write` |
| [deleteEvalSet](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/delete-eval-set.md) | Deletes an evaluation set. | `evaluation:write` |
| [setEvalSetLocked](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/set-eval-set-locked.md) | Locks or unlocks an evaluation set. | `evaluation:read` and `evaluation:lock` |
| [runEvaluation](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/run-evaluation.md) | Starts an evaluation run and returns a run group ID. | `evaluation:write` |
| [scheduleEvalSet](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/schedule-eval-set.md) | Sets or clears a recurring schedule. | `evaluation:schedule` |
| [pauseScheduledEval](https://docs.wisdom.ai/integrations/graphql-api/mutations/evaluation/pause-scheduled-eval.md) | Pauses the schedule of an evaluation set. | `evaluation:schedule` |

For the objects, input types, and enums, see [Evaluation data types](https://docs.wisdom.ai/integrations/graphql-api/objects/evaluation-data-types.md).


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