Base Layer Feedback Implementation¶
Input structure:
{
"response": "user input",
"answer": "original answer",
"params": {
"cases": [
{
"answer": "same shape as original answer",
"feedback": "feedback string",
"params": {...} # Any parameters to set or override
},
...
]
}
}
Execution Logic for the eval
command¶
- First
evaluation_function
is called using the response, answer and params - If evaluation threw an error, then return the error message
- If evaluation was successful, check for matching cases
- If "params" contains a non-empty list of "cases", determine the correct feedback, add it to the result and return the block (Logic for this is described in the next section)
- If "params" doesn't contain a list of cases, simply return the result
Determining the correct feedback case¶
- Iterate through each case in the list of
cases
:- Validate the case has an 'answer' and 'feedback'
- If the case contains 'params', then merge them with the original 'params', overwriting values if they already exist
- Call
evaluation_function
with the student "response", case "answer" and merged "params"- If the function returns "is_correct: true", we have a match, store case and feedback returned from the evaluation function
- If the function returns an error, catch it and add it to a list of warnings
- If no matches were found, don't return any feedback
- If exactly one match was found, check if
override_eval_feedback
is in parameters- If
override_eval_feedback
is set to true, return the case feedback - If
override_eval_feedback
is not set or set to false, append the evaluation function feedback to the case feedback, separated by a linebreak and the return the result
- If
- If more than one matches were found, return the first one (using the same procedure as if only one match was found) and add a warning explaining which cases matched, and why only the first was selected.