Setting up a large language model (LLM) account
For the general public, OpenAI’s ChatGPT models are currently the most popular and well-known LLMs. However, there are many other LLMs available in the market that fit a myriad of purposes. You do not always need to use the most expensive, most powerful LLM. Some LLMs focus on one area, such as the Meditron LLMs, which are medical research-focused fine-tuned versions of Llama 2. If you are in the medical area, you may want to use that LLM instead as it may do better than a big general LLM in your domain. Often, LLMs can be used to double-check other LLMs, so you have to have more than one in those cases. I strongly encourage you to not just use the first LLM you have worked with and to look for the LLM that best suits your needs. But to keep things simpler this early in this book, I am going to talk about setting up OpenAI’s ChatGPT:
- Go to the API section of the OpenAI website: https://openai.com/api/.
- If you have not set up an account yet, do so now. The web page can change often, but look for where to sign up.
Warning
Using OpenAI’s API costs money! Use it sparingly!
- Once you’ve signed up, go to the documentation at https://platform.openai.com/docs/quickstart and follow the instructions to set up your first API key.
- When creating an API key, give it a memorable name and select the type of permissions you want to implement (All, Restricted, or Read Only). If you do not know what option to select, it is best to go with All for now. However, be aware of the other options – you may want to share various responsibilities with other team members but restrict certain types of access:
- All: This key will have read/write access to all of the OpenAI APIs.
- Restricted: A list of available APIs will appear, providing you with granular control over which APIs the key has access to. You have the option of giving just read or write access to each API. Make sure you have at least enabled the models and embedding APIs you will use in these demos.
- Read Only: This option gives you read-only access to all APIs.
- Copy the key provided. You will add this to your code shortly. In the meantime, keep in mind that if this key is shared with anyone else, whomever you provide this key can use it and you will be charged. So, this is a key that you want to consider top secret and take the proper precautions to prevent unauthorized use of it.
- The OpenAI API requires you to buy credits in advance to use the API. Buy what you are comfortable with, and then for more safety, make sure the Enable auto recharge option is off. This will ensure you are only spending what you intend to spend.
With that, you have set up the key component that will serve as the brains in your RAG pipeline: the LLM! Next, we will set up your development environment so that you can connect to the LLM.