1. Learn
  2. /
  3. Courses
  4. /
  5. Multi-Modal Systems with the OpenAI API

Connected

Exercise

Moderating the model response

Even though the chatbot has generated a tailored response, it's important to verify that the content is safe to send to the customer. In this step, you'll moderate the response to ensure all category scores fall below the customer safety threshold.

The model's reply from the previous exercise is available as chatbot_reply.

Instructions

100 XP
  • Send a moderation request with chatbot_reply as input.
  • Extract the response's category scores, convert them to a dictionary using .model_dump(), and check if any score exceeds 0.7.