> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-3071-org-scoped-api-keys.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Evaluation<R, E, M>

> TypeScript SDK reference

Sets up an evaluation which includes a set of scorers and a dataset.

Calling evaluation.evaluate(model) will pass in rows form a dataset into a model matching
the names of the columns of the dataset to the argument names in model.predict.

Then it will call all of the scorers and save the results in weave.

Defined in: [src/evaluation.ts:139](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L139)

## Example

```ts twoslash theme={null}
// @noErrors
// Collect your examples into a dataset
const dataset = new weave.Dataset({
  id: 'my-dataset',
  rows: [
    { question: 'What is the capital of France?', expected: 'Paris' },
    { question: 'Who wrote "To Kill a Mockingbird"?', expected: 'Harper Lee' },
    { question: 'What is the square root of 64?', expected: '8' },
  ],
});

// Define any custom scoring function
const scoringFunction = weave.op(function isEqual({ modelOutput, datasetRow }) {
  return modelOutput == datasetRow.expected;
});

// Define the function to evaluate
const model = weave.op(async function alwaysParisModel({ question }) {
  return 'Paris';
});

// Start evaluating
const evaluation = new weave.Evaluation({
  id: 'my-evaluation',
  dataset: dataset,
  scorers: [scoringFunction],
});

const results = await evaluation.evaluate({ model });
```

## Extends

* [`WeaveObject`](./weaveobject)

## Type Parameters

### R

`R` *extends* `DatasetRow`

### E

`E` *extends* `DatasetRow`

### M

`M`

## Constructors

### Constructor

> **new Evaluation**\<`R`, `E`, `M`>(`parameters`): `Evaluation`\<`R`, `E`, `M`>

Defined in: [src/evaluation.ts:150](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L150)

#### Parameters

##### parameters

`EvaluationParameters`\<`R`, `E`, `M`>

#### Returns

`Evaluation`\<`R`, `E`, `M`>

#### Overrides

[`WeaveObject`](./weaveobject).[`constructor`](./weaveobject#constructor)

## Properties

### \_\_savedRef

> `optional` **\_\_savedRef**: [`ObjectRef`](./objectref) | `Promise`\<[`ObjectRef`](./objectref)>

Defined in: [src/weaveObject.ts:71](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L71)

#### Inherited from

[`WeaveObject`](./weaveobject).[`__savedRef`](./weaveobject#__savedref)

## Accessors

### description

#### Get Signature

> **get** **description**(): `string` | `undefined`

Defined in: [src/weaveObject.ts:98](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L98)

##### Returns

`string` | `undefined`

#### Inherited from

[`WeaveObject`](./weaveobject).[`description`](./weaveobject#description)

***

### name

#### Get Signature

> **get** **name**(): `string`

Defined in: [src/weaveObject.ts:94](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L94)

##### Returns

`string`

#### Inherited from

[`WeaveObject`](./weaveobject).[`name`](./weaveobject#name)

## Methods

### evaluate()

> **evaluate**(`__namedParameters`): `Promise`\<`Record`\<`string`, `any`>>

Defined in: [src/evaluation.ts:165](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L165)

#### Parameters

##### \_\_namedParameters

###### maxConcurrency?

`number` = `5`

###### model

`WeaveCallable`\<(...`args`) => `Promise`\<`M`>>

###### nTrials?

`number` = `1`

#### Returns

`Promise`\<`Record`\<`string`, `any`>>

***

### predictAndScore()

> **predictAndScore**(`__namedParameters`): `Promise`\<\{ `model_latency`: `number`; `model_output`: `any`; `model_success`: `boolean`; `scores`: \{\[`key`: `string`]: `any`; }; }>

Defined in: [src/evaluation.ts:244](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/evaluation.ts#L244)

#### Parameters

##### \_\_namedParameters

###### columnMapping?

`ColumnMapping`\<`R`, `E`>

###### example

`R`

###### model

`WeaveCallable`\<(...`args`) => `Promise`\<`M`>>

#### Returns

`Promise`\<\{ `model_latency`: `number`; `model_output`: `any`; `model_success`: `boolean`; `scores`: \{\[`key`: `string`]: `any`; }; }>

***

### saveAttrs()

> **saveAttrs**(): `object`

Defined in: [src/weaveObject.ts:75](https://github.com/wandb/weave/blob/8c5f077eb11c42b84000726ff20504abc728d3fb/sdks/node/src/weaveObject.ts#L75)

#### Returns

`object`

#### Inherited from

[`WeaveObject`](./weaveobject).[`saveAttrs`](./weaveobject#saveattrs)
