The function process_user_message is expected to return two parameters: response and context (all_messages), but in the steps in which Moderation API may flag (Step 1 - Check user input and Step 5 - Check model answer), it returns just one string:
- Step 1: return “Sorry, we cannot process this request.”
- Step 5: return “Sorry, we cannot provide this information.”
In both lines the parameter all_messages is missing.
BTW, I’ve just realized that the version in the video seems newer than in the jupyter notebook since it has the corrections mentioned above, and many more changes!