From the course: OpenAI API: Building Assistants
How to use the exercise files - OpenAI API Tutorial
From the course: OpenAI API: Building Assistants
How to use the exercise files
- [Instructor] To help you take advantage of what you learn in this course immediately, I've created some code examples for you that you can use in your own projects after watching the course. You can find them all in the GitHub repository for this course. The best way to work with these code examples is to spin them up in your own codespace, and you do that by going to the repository. Click the Code button, navigate to Codespaces, and from here, you can either spin up a new codespace if you don't already have one, or select one you've already started for this repository. In the codespace, you'll see you have two main folders, Node and Python, and these folders contain examples, including a basic completion. This is not using the assistant API, it's just the basic completion. Then the main endpoints for the assistant API to show how they string together. And finally, an interactive example that builds out a chat app. There are two folders, one for Node and one for Python. And the examples in both of these folders are exactly the same, just using the different languages. And what you'll notice when you go through the examples is the endpoints are exactly the same for the library supporting Python and Node. So that means the only thing that's different is the coding language. Having said that, I'm providing both examples, because the way you're calling the endpoints will be different depending on which language you're using, and here you have options. To use these exercise files, you need to do one thing. You need to create a new file called .env. Inside this file, you need to type in this: OPENAI_API_KEY, all caps, =, and then paste in your OpenAI key. The key you see here right now won't work by the time I ship the course, because this is my key. To get this OpenAI key, go to platform.openai.com. And if you don't already have an account, you need to sign up for the account and add your credit card because these tokens that you're going to be using do cost money. Then go to API Keys, click Create New Secret key, give your key a name, and click Create Secret Key. Now, this is important. This is the only time you'll get to see this key, so copy the key without closing this modal. Go back into the env file, paste in your new key, save this file, then go back and click Done, and the modal goes away. Now, if you skipped a step here and you lost the key, that's fine. You can just delete it and create a new one. You can have as many keys as you want, and you can always delete them because they are only for you and they are used for this exact purpose. Once you've added your OpenAI key to the .env file, all the examples in this project will work and associate with your account.