Scoring outputs
JavaScript scorer
Write a custom scoring function with JavaScript
This requires a JS/TS configuration file
You can configure a custom JS/TS scorer by specifying a function in
the scorers
section of the configuration. Both sync and async functions
are supported.
The function has the following signature:
- Arguments
- Object with
- output: object with key
value
to get the output value (string) and keymetadata
to get metadata (object); see output object - inputs: object of key-value pairs from the dataset sample
- output: object with key
- Object with
- Returns
- Score object: object with
score
(number between 0 to 1),message
(optional, string) andname
(optional, string)
- Score object: object with
Multiple scores
It is possible for the method to return an array of score objects. Use name
to distinguish
between them.
Example
The Spider using TS uses this scorer.