Evaluators
Javascript
Write custom JavaScript code to evaluate prompt responses.
The JavaScript Evaluator gives you complete control over how your prompts are evaluated. When writing the JS evaluator function, ensure that:
- The
data
is the object provided to this function. - You return the correct object format that this method expects.
Here are some examples,
Checking if the response starts with a certain phrase
Checking if the response has certain keywords
Checking if the response contains harmful words
Implementing a JavaScript Evaluator
1
Select the JavaScript evaluator from the “Add evaluator” action menu.
2
Define JavaScript code to evaluate the LLM response against your linked dataset.
3
Run the evaluation and see the results.