Aan de slagGa gratis aan de slag

Moderation API

You are developing a chatbot that provides educational content to learn languages. You'd like to make sure that users don't post inappropriate content to your API, and decide to use the moderation API to check users' prompts before generating the response.

Deze oefening maakt deel uit van de cursus

Developing AI Systems with the OpenAI API

Cursus bekijken

Oefeninstructies

  • Use the moderation API to check the user message for inappropriate content within categories.
  • Print the response.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

client = OpenAI(api_key="")

message = "Can you show some example sentences in the past tense in French?"

# Use the moderation API
____

# Print the response
____
Code bewerken en uitvoeren