CommencerCommencez gratuitement

Response translation

You now have a tailored response from the chatbot that passed moderation. Your next task is to translate that response into the original language of the customer request.

The model's reply and the detected country code from the previous exercises are available as chatbot_reply and country_code.

Cet exercice fait partie du cours

<cours>Multi-Modal Systems with the OpenAI API</cours>
Voir le cours

Instructions de l’exercice

  • Use the gpt-4o-mini model to translate chatbot_reply into the language specified by country_code.
  • Extract the translated text from response.

Exercice interactif pratique

Essayez cet exercice en complétant ce code d’exemple.

client = OpenAI(api_key="")

# Translate chatbot reply
response = ____

# Extract translated text
translated_reply = ____
print(translated_reply)
Modifier et exécuter le code