1. Learn
  2. /
  3. Courses
  4. /
  5. Working with the OpenAI API

Exercise

Translating with prompts

The quality of Whisper's translation can vary depending on the language spoken, the audio quality, and the model's awareness of the subject matter. If you have any extra context about what is being spoken about, you can send it along with the audio to the model to give it a helping hand.

You've been provided with with an audio file, audio.wav; you're not sure what language is spoken in it, but you do know it relates to a recent World Bank report. Because you don't know how well the model will perform on this unknown language, you opt to send the model this extra context to steer it in the right direction.

Instructions

100 XP
  • Assign your API key to openai.api_key.
  • Open the audio.wav file.
  • Write a prompt that informs the model that the audio relates to a recent World Bank report, which will help the model produce an accurate translation.
  • Create a request to the Audio endpoint to transcribe audio.wav using your prompt.