From the course: Hands-On OpenAI API: Building a Real-World Solution
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Creating the JSON document using the Chat Completions API - OpenAI API Tutorial
From the course: Hands-On OpenAI API: Building a Real-World Solution
Creating the JSON document using the Chat Completions API
- [Instructor] Our goal is to create one JSON file for each audio file transcription. We could create the JSON document with the current transcription text of course, however, the text is in Spanish. So first we need to translate it into English. I could have used the translations API, but I wanted to show you how we can do it by using a single prompt and the chat completions API. So let's do the following. Let's execute create that comes from the completions object. And here I'm specifying gpt-3.5-turbo-1106 as the name of the model that I want to use. And then let's pass the messages to the model. With the chat completion API, we can ask the large language model to perform any task or return any kind of information. To get the most out of large language models, such as the open AI ones, we should specify clear instructions. That is one of the most important prompt engineering strategies for getting better results. So here I'm specifying the system role and I'm telling it that it…