From the course: Hands-On AI: RAG using LlamaIndex

Setting up LLM accounts - LlamaIndex Tutorial

From the course: Hands-On AI: RAG using LlamaIndex

Setting up LLM accounts

- [Instructor] In this video, I'm going to show you how to get your OpenAI and Cohere API keys. So if you just click on this link right here and go to either Log In or Sign Up, if you haven't already signed up for OpenAI, it's quite easy to do so. You can sign up with Google, Apple, Microsoft account, whatever you want. If you've already signed up for OpenAI, then this is just going to be a refresher for you. But I'll go ahead and sign up into my account. Once you've signed into the platform, so platform.openai.com, you want to go to the sidebar here and click on API keys and I'm going to create a new secret key. So this is the same pattern you're going to do if you've never created a secret key, then you're going to see the same button anyways. I'll call this lil_llama_index and I'll create the secret key. Copy that key and copy it, put it somewhere safe, copy and paste it somewhere immediately because you're not going to be able to see that again and we need this key. I'm going to invalidate this key after we're done recording this course anyways, but that is what I need to do right there, so copy and paste that away. We'll go ahead and get our Cohere API key, so you can log in or sign up. It's going to be the same kind of pattern. In this case, I'm going to continue with Google. Once you've logged into Cohere, you'll be brought to the dashboard. You're going to click on API key here and you'll create a key. Cohere is nice because you can come back and always look at the API key if you'd like, but I'll go ahead and create a new API key. I'll call this lil_llama_index and generate that key, copy it. Also, we will need to make use of this, so put it somewhere safe. Great. So we've got our API keys. Now what we need to do is create an environment variable and just keep our keys in the environment variable. So I'm going to open up a terminal, so that's Control + Shift + Tick. Let's go ahead and make sure I've got this. Control + Shift + Tick. Let's create now a .env file. So what I'm going to do is touch .env. This is going to create a .env file here. And I have also an env_example, so you can copy this env_example and paste the appropriate ones in here. So for right now, let's just copy and paste our Cohere API keys and our OpenAI API keys. You can disregard this LangChain thing 'cause we're not going to be using LangChain. And in the environment variables, you can ahead and copy and paste the API keys like so. Just make sure you're not pushing any of these API keys to your GitHub repository because you don't want this information to be public. So there we go, so we've got our .env file created and we've added a couple of environment variables. In the next video, I'm going to talk to you about choosing a vector database and then I'm going to show you how to set up Qdrant, which is going to be our vector database of choice. So I'll see you in the next video.

Contents