From 0af418934ade7619aca2297509ae472d3f533c6e Mon Sep 17 00:00:00 2001 From: Ian Arawjo Date: Thu, 29 Jun 2023 10:07:50 -0400 Subject: [PATCH] Edits to info modal on Eval node --- chainforge/react-server/src/EvaluatorNode.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/chainforge/react-server/src/EvaluatorNode.js b/chainforge/react-server/src/EvaluatorNode.js index e4f10f2..079ba45 100644 --- a/chainforge/react-server/src/EvaluatorNode.js +++ b/chainforge/react-server/src/EvaluatorNode.js @@ -47,12 +47,12 @@ class ResponseInfo: const _info_example_py = ` def evaluate(response): - # Returns the length of the response + # Return the length of the response (num of characters) return len(response.text); `; const _info_example_js = ` function evaluate(response) { - // Returns the length of the response + // Return the length of the response (num of characters) return response.text.length; }`; const _info_example_var_py = ` @@ -60,14 +60,14 @@ def evaluate(response): country = response.var['country']; # do something with country here, such as lookup whether # the correct capital is in response.text - return ... # True or False + return ... # for instance, True or False `; const _info_example_var_js = ` function evaluate(response) { let country = response.var['country']; // do something with country here, such as lookup whether // the correct capital is in response.text - return ... # true or false + return ... // for instance, true or false }`; const EvaluatorNode = ({ data, id }) => { @@ -257,11 +257,13 @@ const EvaluatorNode = ({ data, id }) => { To use a {default_header}, write a function evaluate that takes a single argument of class ResponseInfo. - If you just want the text of the response, use response.text: + The function should return a 'score' for that response, which usually is a number or a boolean value (strings as categoricals are supported, but experimental). + + For instance, here is an evaluator that returns the length of a response: {progLang === 'python' ? _info_example_py : _info_example_js} - The full ResponseInfo class has the following properties and methods: + This function gets the text of the response via response.text, then calculates its length in characters. The full ResponseInfo class has the following properties and methods: {progLang === 'python' ? _info_codeblock_py : _info_codeblock_js}