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

# Scorers

***

# Class: Scorers

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Service class for scorer operations.

## Constructors

### Constructor

```ts theme={null}
new Scorers(): Scorers;
```

#### Returns

`Scorers`

## Methods

### create()

```ts theme={null}
create(options: object): Promise<ScorerResponse>;
```

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Creates a new scorer.

#### Parameters

##### options

The scorer creation options.

###### defaults?

\{
`cot_enabled?`: `null` | `boolean`;
`filters?`: | `null`
\| (
\| \{
`case_sensitive?`: `boolean`;
`filter_type?`: `"string"`;
`name`: `"node_name"`;
`operator`: `"eq"` | `"ne"` | `"contains"`;
`value`: `string`;
}
\| \{
`filter_type?`: `"map"`;
`key`: `string`;
`name`: `"metadata"`;
`operator`: `"eq"` | `"ne"` | `"not_in"` | `"one_of"`;
`value`: `string` | `string`\[];
})\[];
`input_type?`: | `null`
\| `"basic"`
\| `"llm_spans"`
\| `"retriever_spans"`
\| `"sessions_normalized"`
\| `"sessions_trace_io_only"`
\| `"tool_spans"`
\| `"trace_input_only"`
\| `"trace_io_only"`
\| `"trace_normalized"`
\| `"trace_output_only"`
\| `"agent_spans"`
\| `"workflow_spans"`;
`model_name?`: `null` | `string`;
`num_judges?`: `null` | `number`;
`output_type?`: | `null`
\| `"boolean"`
\| `"categorical"`
\| `"count"`
\| `"discrete"`
\| `"freeform"`
\| `"percentage"`
\| `"multilabel"`;
`scoreable_node_types?`: `null` | `string`\[];
}

(Optional) Default settings for the scorer.

###### defaults.cot\_enabled?

`null` | `boolean`

Cot Enabled

**Description**

Whether to enable chain of thought for this scorer. Defaults to False for llm scorers.

###### defaults.filters?

\| `null`
\| (
\| \{
`case_sensitive?`: `boolean`;
`filter_type?`: `"string"`;
`name`: `"node_name"`;
`operator`: `"eq"` | `"ne"` | `"contains"`;
`value`: `string`;
}
\| \{
`filter_type?`: `"map"`;
`key`: `string`;
`name`: `"metadata"`;
`operator`: `"eq"` | `"ne"` | `"not_in"` | `"one_of"`;
`value`: `string` | `string`\[];
})\[]

Filters

**Description**

List of filters to apply to the scorer.

###### defaults.input\_type?

\| `null`
\| `"basic"`
\| `"llm_spans"`
\| `"retriever_spans"`
\| `"sessions_normalized"`
\| `"sessions_trace_io_only"`
\| `"tool_spans"`
\| `"trace_input_only"`
\| `"trace_io_only"`
\| `"trace_normalized"`
\| `"trace_output_only"`
\| `"agent_spans"`
\| `"workflow_spans"`

**Description**

What type of input to use for model-based scorers (sessions\_normalized, trace\_io\_only, etc..).

###### defaults.model\_name?

`null` | `string`

Model Name

###### defaults.num\_judges?

`null` | `number`

Num Judges

###### defaults.output\_type?

\| `null`
\| `"boolean"`
\| `"categorical"`
\| `"count"`
\| `"discrete"`
\| `"freeform"`
\| `"percentage"`
\| `"multilabel"`

**Description**

What type of output to use for model-based scorers (boolean, categorical, etc.).

###### defaults.scoreable\_node\_types?

`null` | `string`\[]

Scoreable Node Types

**Description**

List of node types that can be scored by this scorer. Defaults to llm/chat.

###### defaultVersionId?

`string`

(Optional) The default version ID for the scorer.

###### description?

`string`

(Optional) A description for the scorer.

###### inputType?

[`InputType`](/sdk-api/typescript/reference/types/enumerations/InputType)

(Optional) The input type for the scorer.

###### modelType?

`"llm"` | `"code"` | `"slm"`

(Optional) The model type for the scorer.

###### name

`string`

The name of the scorer.

###### outputType?

[`OutputType`](/sdk-api/typescript/reference/types/enumerations/OutputType)

(Optional) The output type for the scorer.

###### scoreableNodeTypes?

(`"agent"` | `"llm"` | `"retriever"` | `"tool"` | `"workflow"` | `"trace"` | `"session"`)\[]

(Optional) The node types that can be scored.

###### scorerType

[`ScorerTypes`](/sdk-api/typescript/reference/types/enumerations/ScorerTypes)

The type of the scorer.

###### tags?

`string`\[]

(Optional) Tags to associate with the scorer.

#### Returns

`Promise`\<[`ScorerResponse`](/sdk-api/typescript/reference/types/type-aliases/ScorerResponse)>

A promise that resolves to the created scorer.

***

### createCodeScorerVersion()

```ts theme={null}
createCodeScorerVersion(
   scorerId: string,
   codeContent: string,
validationResult?: string): Promise<BaseScorerVersionResponse>;
```

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Creates a code-based scorer version.

#### Parameters

##### scorerId

`string`

The unique identifier of the scorer.

##### codeContent

`string`

The Python code content for the scorer.

##### validationResult?

`string`

(Optional) The validation result JSON string.

#### Returns

`Promise`\<[`BaseScorerVersionResponse`](/sdk-api/typescript/reference/types/type-aliases/BaseScorerVersionResponse)>

A promise that resolves to the created scorer version.

***

### createLlmScorerVersion()

```ts theme={null}
createLlmScorerVersion(options: object): Promise<BaseScorerVersionResponse>;
```

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Creates a new LLM scorer version.

#### Parameters

##### options

The LLM scorer version creation options.

###### chainPollTemplate?

\{
`explanation_field_name?`: `string`;
`metric_description?`: `null` | `string`;
`metric_few_shot_examples?`: `object`\[];
`metric_system_prompt?`: `null` | `string`;
`response_schema?`: | `null`
\| \{
\[`key`: `string`]: `unknown`;
};
`template`: `string`;
`value_field_name?`: `string`;
}

(Optional) Chain poll template configuration.

###### chainPollTemplate.explanation\_field\_name?

`string`

Explanation Field Name

**Description**

Field name to look for in the chainpoll response, for the explanation.

**Default**

```ts theme={null}
explanation;
```

###### chainPollTemplate.metric\_description?

`null` | `string`

Metric Description

**Description**

Description of what the metric should do.

###### chainPollTemplate.metric\_few\_shot\_examples?

`object`\[]

Metric Few Shot Examples

**Description**

Few-shot examples for the metric.

###### chainPollTemplate.metric\_system\_prompt?

`null` | `string`

Metric System Prompt

**Description**

System prompt for the metric.

###### chainPollTemplate.response\_schema?

\| `null`
\| \{
\[`key`: `string`]: `unknown`;
}

Response Schema

**Description**

Response schema for the output

###### chainPollTemplate.template

`string`

Template

**Description**

Chainpoll prompt template.

###### chainPollTemplate.value\_field\_name?

`string`

Value Field Name

**Description**

Field name to look for in the chainpoll response, for the rating.

**Default**

```ts theme={null}
rating;
```

###### cotEnabled?

`boolean`

(Optional) Whether chain-of-thought is enabled.

###### instructions?

`string`

(Optional) Instructions for the LLM scorer.

###### modelName?

`string`

(Optional) The model name to use.

###### numJudges?

`number`

(Optional) The number of judges for consensus.

###### scorerId

`string`

The unique identifier of the scorer.

###### userPrompt?

`string`

(Optional) User prompt for the LLM scorer.

#### Returns

`Promise`\<[`BaseScorerVersionResponse`](/sdk-api/typescript/reference/types/type-aliases/BaseScorerVersionResponse)>

A promise that resolves to the created scorer version.

***

### delete()

```ts theme={null}
delete(scorerId: string): Promise<DeleteScorerResponse>;
```

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Deletes a scorer by ID.

#### Parameters

##### scorerId

`string`

The unique identifier of the scorer to delete.

#### Returns

`Promise`\<[`DeleteScorerResponse`](/sdk-api/typescript/reference/types/type-aliases/DeleteScorerResponse)>

A promise that resolves to a response containing a success message.

***

### getScorerVersion()

```ts theme={null}
getScorerVersion(scorerId: string, version: number): Promise<BaseScorerVersionResponse>;
```

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Gets a specific scorer version.

#### Parameters

##### scorerId

`string`

The unique identifier of the scorer.

##### version

`number`

The version number to retrieve.

#### Returns

`Promise`\<[`BaseScorerVersionResponse`](/sdk-api/typescript/reference/types/type-aliases/BaseScorerVersionResponse)>

A promise that resolves to the scorer version.

***

### list()

```ts theme={null}
list(options?: object): Promise<ScorerResponse[]>;
```

Defined in: [src/entities/scorers.ts](https://github.com/rungalileo/galileo-js/blob/main/src/entities/scorers.ts)

Lists scorers with optional filtering and built-in pagination.

#### Parameters

##### options?

(Optional) The filtering options.

###### name?

`string`

(Optional) Filter by a single scorer name.

###### names?

`string`\[]

(Optional) Filter by multiple scorer names.

###### types?

[`ScorerTypes`](/sdk-api/typescript/reference/types/enumerations/ScorerTypes)\[]

(Optional) Filter by scorer types.

#### Returns

`Promise`\<[`ScorerResponse`](/sdk-api/typescript/reference/types/type-aliases/ScorerResponse)\[]>

A promise that resolves to an array of scorers.
