# DynamicRunEvaluator

> **Class** in `langsmith`

📖 [View in docs](https://reference.langchain.com/python/langsmith/evaluation/evaluator/DynamicRunEvaluator)

A dynamic evaluator that wraps a function and transforms it into a `RunEvaluator`.

This class is designed to be used with the `@run_evaluator` decorator, allowing
functions that take a `Run` and an optional `Example` as arguments, and return
an `EvaluationResult` or `EvaluationResults`, to be used as instances of `RunEvaluator`.

## Signature

```python
DynamicRunEvaluator(
    self,
    func: Callable[[Run, Optional[Example]], Union[_RUNNABLE_OUTPUT, Awaitable[_RUNNABLE_OUTPUT]]],
    afunc: Optional[Callable[[Run, Optional[Example]], Awaitable[_RUNNABLE_OUTPUT]]] = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `func` | `Callable` | Yes | A function that takes a `Run` and an optional `Example` as |

## Extends

- `RunEvaluator`

## Constructors

```python
__init__(
    self,
    func: Callable[[Run, Optional[Example]], Union[_RUNNABLE_OUTPUT, Awaitable[_RUNNABLE_OUTPUT]]],
    afunc: Optional[Callable[[Run, Optional[Example]], Awaitable[_RUNNABLE_OUTPUT]]] = None,
)
```

| Name | Type |
|------|------|
| `func` | `Callable[[Run, Optional[Example]], Union[_RUNNABLE_OUTPUT, Awaitable[_RUNNABLE_OUTPUT]]]` |
| `afunc` | `Optional[Callable[[Run, Optional[Example]], Awaitable[_RUNNABLE_OUTPUT]]]` |


## Properties

- `afunc`
- `func`
- `is_async`

## Methods

- [`evaluate_run()`](https://reference.langchain.com/python/langsmith/evaluation/evaluator/DynamicRunEvaluator/evaluate_run)
- [`aevaluate_run()`](https://reference.langchain.com/python/langsmith/evaluation/evaluator/DynamicRunEvaluator/aevaluate_run)

---

[View source on GitHub](https://github.com/langchain-ai/langsmith-sdk/blob/cc54cc2729bb1cfe402fd9f34cf953de60bde30c/python/langsmith/evaluation/evaluator.py#L162)