To get the most out of this book
To get the most value from this book, read through the introductory material and then follow on with the use cases listed. We recommend copying the code and running it on your own. This provides valuable hands-on experience.
Throughout this book, we use ChatGPT, Python, and Power BI, so it is a good idea to have these available for the code examples.
Here are a few recommended steps to set up ChatGPT, Python, and Power BI:
Install Python and enable Python in Power BI:
- First, install Python, if you have not done so already. Visit the official website (https://www.python.org/downloads/) for your download. We recommend versions 3.9 or 3.10.
- After Python has installed, enable Python scripting in Power BI. Open the Power BI desktop. Click File | Options and settings | Options | Python scripting. Select the checkbox and OK.
- Then, set the Python path in Power BI. Go to File | Options and settings | Options | Python scripting, and then click on Detect. This selects the Python installation path automatically. You can also do this manually by clicking on the ellipsis (…) and selecting the Python executable file.
- Restart the Power BI desktop for the changes you made to take effect.
Setting up ChatGPT using ChatGPT API:
- First, you will need to obtain an API key from OpenAI. Navigate to the OpenAI website (https://openai.com) and create a (personal) account.
- Then, request and get an API key. Use this in all your integration projects.
Tip
These API keys are not free. When you sign up with OpenAI, you get about $18 worth of tokens for use with your API key. After that, it is billed (pay as you go). The details are available on the OpenAI site under Pricing (https://openai.com/pricing).
- The ChatGPT API has SDKs and libraries available in several programming languages. Select Python. We use Python extensively in this book and recommend it.
- Install the SDK with a package manager such as
pip
.
We assume you are running Windows 10 or any version after on your device. Although the code has been tested, the installations might be slightly different for Linux, Chrome, and macOS. There are no known issues with installations. You will also need a stable robust browser (MS Edge or similar is recommended).
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.