# Chalk Compute Reference: Evaluation
source: https://docs.chalk.ai/compute-docs#section-evaluation

Offline evaluation of a task function against a pinned dataset revision.

An evaluation pairs one dataset revision, one task version and one or more scorer versions, and is immutable once created. Running it queues an [`EvaluationRun`](https://docs.chalk.ai/compute-docs#EvaluationRun) that calls the task per row, passes each output to every scorer, and writes the scores to a result dataset.

## `Evaluation`
source: https://docs.chalk.ai/compute-docs#Evaluation

Class

A persisted, immutable evaluation definition.

**Attributes**

- `id`: `str`
- `name`: `str`
- `dataset`: `DatasetRevisionRef`
- `task_function_version_id`: `str`
- `scorers`: `tuple[EvaluationScorer, ...]`
- `metadata`: `dict[str, Any]`
- `team_id`: `str | None`
- `environment_id`: `str | None`
- `created_by`: `str | None`
- `created_at`: `datetime | None`
- `suite_id`: `str | None`
- `archived_at`: `datetime | None`
- `archived_by`: `str | None`
- `dataset_id`: `str`
  Dataset identifier pinned by this evaluation.
- `dataset_revision_id`: `str`
  Dataset revision identifier pinned by this evaluation.

### `Evaluation.@create(name, dataset, task, scorers, metadata, suite_id, chalk_client)`
source: https://docs.chalk.ai/compute-docs#Evaluation.create

Create an evaluation from deployed function handles.

`task` and every function scorer must already be deployed. Handles returned by `@chalkcompute.function` meet this requirement because resolving their version waits for the decorator's background deployment. A [`SqlExpression`](https://docs.chalk.ai/compute-docs#SqlExpression) deploys nothing and is sent as its expression.

### `Evaluation.from_id(evaluation_id, chalk_client)`
source: https://docs.chalk.ai/compute-docs#Evaluation.from_id

Attach to an existing evaluation by identifier.

### `Evaluation.archive()`
source: https://docs.chalk.ai/compute-docs#Evaluation.archive

Archive this definition and return its updated representation.

Hides the evaluation and its runs from lists without deleting datasets or canceling running work. The existing handle is not mutated.

### `Evaluation.refresh()`
source: https://docs.chalk.ai/compute-docs#Evaluation.refresh

Return the latest server representation of this evaluation.

### `Evaluation.run(metadata, execution_mode)`
source: https://docs.chalk.ai/compute-docs#Evaluation.run

Queue a run of this evaluation and return its handle.

`execution_mode` selects how the server drives the run to completion; the server defaults to `"on_read"` when it is omitted.

### `Evaluation.runs(limit)`
source: https://docs.chalk.ai/compute-docs#Evaluation.runs

Iterate this evaluation's runs, newest first.

### `Evaluation.rescore(run, metadata)`
source: https://docs.chalk.ai/compute-docs#Evaluation.rescore

Score a finished run's outputs with this evaluation's scorers.

The task is not re-run: its outputs are read back out of `run`'s result. `run` may belong to this evaluation or to any other that uses the same dataset revision and task function version, and the new run is recorded under this one.

## `EvaluationRun`
source: https://docs.chalk.ai/compute-docs#EvaluationRun

Class

A queued or completed execution of an evaluation.

**Attributes**

- `id`: `str`
- `evaluation_id`: `str`
- `status`: `EvaluationRunStatus`
- `metadata`: `dict[str, Any]`
- `team_id`: `str | None`
- `environment_id`: `str | None`
- `created_by`: `str | None`
- `created_at`: `datetime | None`
- `started_at`: `datetime | None`
- `completed_at`: `datetime | None`
- `result_dataset_id`: `str | None`
- `result_dataset_revision_id`: `str | None`
- `error_message`: `str | None`
- `execution_mode`: `EvaluationRunExecutionMode`
  How the server drives this run to completion.
- `is_terminal`: `bool`
  Whether this run has reached a terminal state.
- `result_dataset`: `DatasetRevisionRef | None`
  Result dataset revision produced by a successful run, if available.

### `EvaluationRun.from_id(evaluation_run_id, chalk_client)`
source: https://docs.chalk.ai/compute-docs#EvaluationRun.from_id

Attach to an existing evaluation run by identifier.

### `EvaluationRun.archive()`
source: https://docs.chalk.ai/compute-docs#EvaluationRun.archive

Hide this run from lists and clear its baseline flag.

Does not cancel execution or delete the result dataset.

### `EvaluationRun.refresh()`
source: https://docs.chalk.ai/compute-docs#EvaluationRun.refresh

Return the latest server representation of this run.

### `EvaluationRun.wait(timeout, poll_interval, raise_on_failure)`
source: https://docs.chalk.ai/compute-docs#EvaluationRun.wait

Wait for this run to finish and return its final representation.

**Parameters**

- `timeout`: `float | None` = `600.0`
  Maximum seconds to wait. [`None`](https://docs.python.org/3/library/constants.html#None) waits indefinitely.
- `poll_interval`: `float` = `2.0`
  Seconds between status polls.
- `raise_on_failure`: `bool` = `True`
  Raise [`EvaluationRunFailedError`](https://docs.chalk.ai/compute-docs#EvaluationRunFailedError) for failed or canceled runs. Set to [`False`](https://docs.python.org/3/library/constants.html#False) to inspect the terminal handle directly.

### `EvaluationRun.rescore(scorers, evaluation, name, metadata)`
source: https://docs.chalk.ai/compute-docs#EvaluationRun.rescore

Score this run's outputs again without re-running the task.

With no arguments, the outputs are scored by this run's own evaluation's scorers. `scorers` scores them with new ones instead: an evaluation is created from this run's, with the same dataset revision, task and suite and only the scorers replaced, named `name` or `"<evaluation name> (rescored)"`. `evaluation` names an existing evaluation to score them with, which must use this run's dataset revision and task function version.

The new run is recorded under whichever evaluation scored it, and is read, waited on and summarized like any other of its runs.

## `EvaluationRunStatus`
source: https://docs.chalk.ai/compute-docs#EvaluationRunStatus

Enum (bases: `str`, `Enum`)

Lifecycle state of an evaluation run.

## `EvaluationSuite`
source: https://docs.chalk.ai/compute-docs#EvaluationSuite

Class

A named collection of evaluations and their runs.

**Attributes**

- `id`: `str`
- `name`: `str`
- `team_id`: `str | None`
- `environment_id`: `str | None`
- `created_by`: `str | None`
- `created_at`: `datetime | None`
- `archived_at`: `datetime | None`
- `archived_by`: `str | None`

### `EvaluationSuite.archive()`
source: https://docs.chalk.ai/compute-docs#EvaluationSuite.archive

Hide this suite and its evaluations and runs, preserving datasets.

### `EvaluationSuite.create(name, chalk_client)`
source: https://docs.chalk.ai/compute-docs#EvaluationSuite.create

Create an evaluation suite in the active environment.

### `EvaluationSuite.list_all(chalk_client)`
source: https://docs.chalk.ai/compute-docs#EvaluationSuite.list_all

List the evaluation suites in the active environment.

### `EvaluationSuite.evaluations(limit)`
source: https://docs.chalk.ai/compute-docs#EvaluationSuite.evaluations

Iterate the evaluations in this suite, newest first.

### `EvaluationSuite.runs(limit)`
source: https://docs.chalk.ai/compute-docs#EvaluationSuite.runs

Iterate the evaluation runs in this suite, newest first.

## `EvaluationClient`
source: https://docs.chalk.ai/compute-docs#EvaluationClient

Class

Client for creating evaluation definitions and managing their runs.

### `EvaluationClient.create_suite(name)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.create_suite

Create an evaluation suite in the active environment.

### `EvaluationClient.list_suites()`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.list_suites

List the evaluation suites in the active environment.

### `EvaluationClient.archive_suite(suite_id)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.archive_suite

Archive a suite and hide its evaluations and runs from lists.

Preserves datasets and running work. Default cannot be archived. Repeated calls succeed; the original handle is not mutated.

### `EvaluationClient.archive(evaluation_id)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.archive

Archive a definition without deleting its runs or datasets.

Archived definitions and their runs are omitted from lists, but remain accessible by ID. Repeating the operation succeeds.

### `EvaluationClient.archive_run(evaluation_run_id)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.archive_run

Archive a run without canceling it or deleting its result dataset.

Clears the run's baseline flag. Repeating the operation succeeds.

### `EvaluationClient.create(name, dataset, task, scorers, metadata, suite_id)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.create

Persist an evaluation pinned to deployed function versions.

### `EvaluationClient.get(evaluation_id)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.get

Fetch an evaluation by identifier.

### `EvaluationClient.list(suite_id, limit)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.list

Iterate unarchived evaluations, optionally filtered by suite.

### `EvaluationClient.run(evaluation_id, metadata, execution_mode)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.run

Queue a run for an existing evaluation.

`execution_mode` selects how the server drives the run to completion; the server defaults to `"on_read"` when it is omitted.

### `EvaluationClient.rescore(evaluation_run_id, evaluation_id, metadata)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.rescore

Queue a run that scores a finished run's outputs without its task.

`evaluation_id` names the evaluation whose scorers score the outputs and that the new run is recorded under. It defaults to the finished run's own, and otherwise must use the same dataset revision and task function version.

### `EvaluationClient.get_run(evaluation_run_id)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.get_run

Fetch an evaluation run by identifier.

### `EvaluationClient.list_runs(evaluation_id, suite_id, limit)`
source: https://docs.chalk.ai/compute-docs#EvaluationClient.list_runs

Iterate unarchived runs whose evaluations are also unarchived.

Optionally filter by evaluation or suite.

## `EvaluationScorer`
source: https://docs.chalk.ai/compute-docs#EvaluationScorer

Class

A versioned scorer attached to an evaluation.

**Attributes**

- `id`: `str`
  Evaluation-local scorer identifier.
- `function_version_id`: `str | None`
  Remote function version backing the scorer, when function-backed.
- `builtin_id`: `str | None`
  Immutable built-in scorer identifier, when built-in.
- `sql_name`: `str | None`
  Scorer name, when the scorer is a Chalk SQL expression.
- `sql_expression`: `str | None`
  The Chalk SQL expression, when the scorer is one.

## `EvaluationScorerResult`
source: https://docs.chalk.ai/compute-docs#EvaluationScorerResult

Class

The score and optional row-level metadata returned by a scorer function.

Annotating a `@chalkcompute.function` with this return type installs its Arrow struct contract automatically. Scorer functions must return an [`EvaluationScorerResult`](https://docs.chalk.ai/compute-docs#EvaluationScorerResult) instance rather than an untyped dictionary.

**Attributes**

- `score`: `float`
  Normalized score in the inclusive range `[0, 1]`.
- `metadata`: `Mapping[str, Any] | None`
  Optional JSON-serializable metadata retained with the scored row.

## `DatasetRevisionRef`
source: https://docs.chalk.ai/compute-docs#DatasetRevisionRef

Class

A reference to a specific revision or a dataset's latest revision.

**Attributes**

- `dataset_id`: `str | None`
  Dataset identifier. Must be paired with `revision_id`.
- `revision_id`: `str | None`
  Completed dataset revision identifier. Must be paired with `dataset_id`.
- `dataset_name`: `str | None`
  Dataset whose latest revision should be resolved when reading or evaluating.

## `DatasetRevisionLike`
source: https://docs.chalk.ai/compute-docs#DatasetRevisionLike

Class (bases: `Protocol`)

Structural type accepted for ChalkPy dataset revisions.

**Attributes**

- `dataset_id`: `object`
  Dataset identifier exposed by the revision handle.
- `revision_id`: `object`
  Revision identifier exposed by the revision handle.

## `DatasetNameLike`
source: https://docs.chalk.ai/compute-docs#DatasetNameLike

Class (bases: `Protocol`)

Structural type accepted for references to the latest dataset revision.

**Attributes**

- `dataset_name`: `object`
  Dataset name whose latest revision should be resolved.

## `EvaluationError`
source: https://docs.chalk.ai/compute-docs#EvaluationError

Exception (bases: `Exception`)

Base exception for evaluation SDK operations.

## `EvaluationNotFoundError`
source: https://docs.chalk.ai/compute-docs#EvaluationNotFoundError

Class (bases: `EvaluationError`)

Raised when an evaluation or evaluation run does not exist.

## `EvaluationRunFailedError`
source: https://docs.chalk.ai/compute-docs#EvaluationRunFailedError

Class (bases: `EvaluationError`)

Raised when a waited evaluation run fails or is canceled.
