---
title: Evaluation
description: Score a batch of examples using hosted scorers or Code judges.
seo:
  title: Evaluation — Python SDK
  description: Score a batch of examples using hosted scorers or Code judges. (Python SDK)
---

Create an `Evaluation` via `client.evaluation.create()`, then call
`.run()` to execute scorers against your examples.

Two modes are supported:

* **Hosted scorers** -- pass scorer names as strings (e.g.
  `"faithfulness"`, `"answer_relevancy"`). Evaluation runs server-side
  on the Judgment platform.
* **Code judges** -- pass `Judge` subclass instances for in-process
  evaluation with your own scoring logic.

Using hosted scorers:

```python
evaluation = client.evaluation.create()
results = evaluation.run(
    examples=examples,
    scorers=["faithfulness", "answer_relevancy"],
    eval_run_name="nightly-eval",
)
for result in results:
    print(result.scorers_data)
```

Using a Code judge:

```python
evaluation = client.evaluation.create()
results = evaluation.run(
    examples=examples,
    scorers=[ToxicityJudge()],
    eval_run_name="toxicity-check",
)
```

## \_\_init\_\_()

```python
def __init__(client, project_id, project_name):
```

### Parameters

| Prop           | Type                 | Default | Description |
| -------------- | -------------------- | ------- | ----------- |
| `client`       | `JudgmentSyncClient` | -       |             |
| `project_id`   | `Optional[str]`      | -       |             |
| `project_name` | `str`                | -       |             |

***

## run()

Run scorers against your examples and return results.

Pass **either** hosted scorer names (strings) **or** Code judge
(`Judge`) instances. Mixing both in one call is not supported.

```python
results = evaluation.run(
    examples=[
        Example.create(
            input="What is Python?",
            actual_output="A programming language.",
            expected_output="A high-level programming language.",
        ),
    ],
    scorers=["answer_relevancy"],
    eval_run_name="quick-test",
)
print(results[0].scorers_data)
```

```python
def run(examples, scorers, eval_run_name, assert_test=False, timeout_seconds=300) -> typing.List:
```

### Parameters

| Prop               | Type                            | Default | Description                                                                              |
| ------------------ | ------------------------------- | ------- | ---------------------------------------------------------------------------------------- |
| `examples`         | `List[Example]`                 | -       | The Example objects to evaluate.                                                         |
| `scorers`          | `Union[List[str], List[Judge]]` | -       | Hosted scorer names (e.g. ["faithfulness"]) or Judge instances (e.g. [ToxicityJudge()]). |
| `eval_run_name`    | `str`                           | -       | A name for this run, visible in the dashboard.                                           |
| `assert_test?`     | `bool`                          | `False` | Deprecated and ignored by the current evaluation result payload.                         |
| `timeout_seconds?` | `int`                           | `300`   | Maximum seconds to wait for hosted scorer results before timing out.                     |

### Returns

`typing.List` - A list of `ScoringResult` objects, one per example.
