From the course: Introduction to Multimodal Prompting for Generative AI
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
GPT-4 API with various input types
From the course: Introduction to Multimodal Prompting for Generative AI
GPT-4 API with various input types
- [Instructor] In this one, we're going to experiment with the OpenAI API, but you don't have to know how to code to follow along. If you're not familiar with coding or APIs, feel free to follow along with this example using the ChatGPT interface. Now, if you head over to platform.openai.com and create an account, you can go ahead and grab an API key. Once you've done that, head over to a terminal and export the environment variable, OPEN_AI_API_KEY. And this is of course a secret key, so I'm not going to export the actual key, but this is where the key would go. And once you've done that, you want to install the OpenAI Python package. So python3 -m pip install openai. And if you're running a virtual environment, you can install it to that virtual environment. Now this platform offers a unique interface called The Playground, and you can get started in The Playground, select which model you wish to use. I'm going to go ahead and use GPT-4o, and then you can insert a system message, so…