‫ChatGPT is an advanced natural language processing model that uses deep learning techniques to understand
‫and generate human like texts.
‫In simple words, if we ask anything to tell GPT, then it will provide us with an answer of our question,
‫and that generated text sound like it's coming from a human.
‫Now let's discuss how we can integrate ChatGPT with Jupyter Notebook.
‫So by using the open AI Python package, we can connect our Jupyter notebook environment to the ChatGPT
‫API.
‫To get started with the ChatGPT API.
‫First of all, you need an OpenAI account.
‫If you don't have one, then you have to sign up in your OpenAI account.
‫For this, you have to visit OpenAI website, which is openai.com, and here you have to log in or sign
‫up to your account.
‫Once you have created your account, navigate to the OpenAI dashboard.
‫You can usually find dashboard or account link in the top right corner of the website.
‫Click on it to access your dashboard.
‫In the dashboard, you will find various sections and settings related to your OpenAI account.
‫Look for the API keys or credentials section as this is where you can generate your API key.
‫Click on the API keys or credentials section to expand it.
‫Here you will have the option to create a new API key.
‫Click on the Create New Key or Generate Key button to generate your API key.
‫Once you have generated your API key, copy it.
‫This key is essential for authenticating your request to the ChatGPT API.
‫That's how we log in to OpenAI.
‫Create an account and obtain your API key.
‫Now let's move on to the next step integrating the ChatGPT API with Jupyter Notebook.
‫With the Openeye Python package and a few lines of code, we can connect our Jupyter Notebook environment
‫to the ChatGPT API to integrate the ChatGPT API with Jupyter Notebook.
‫We will be using the OpenAI Python package.
‫First, make sure that you have the package installed.
‫You can do this by running pip install OpenAI in your Jupyter notebook environment.
‫Which code I am using here is stored in this API file.
‫I have provided a link of this file in the description of this video.
‫If you want to use this code, then you have to download this code and upload it.
‫From here we will open this file and now we have our codes ready.
‫Let me explain you this code for you.
‫So here you have to replace this API key with your actual API key.
‫And then we have a function which is get GPT response that takes the prompt and the optional max token
‫parameter.
‫This function will communicate with ChatGPT API and return the response based upon the given prompt.
‫Next we make the API response using completion create.
‫Here our model is GPT 3.5 turbo and then message max tokens and the temperature.
‫Experimenting with the temperature can achieve different styles of response.
‫And at last our response.
‫Now we will write our prompt.
‫So first I will write what is ChatGPT?
‫Let's run this code.
‫And here you can see it has written that ChatGPT is a language model developed by OpenAI.
‫It is based on the GPT three architecture, which uses deep learning techniques to generate human like
‫text responses and so on.
‫Now I will write my second prompt, which is how to treat outliers in machine learning.
‫If I run this code here, you can see that it has actually given me four ways to treat outliers, which
‫is removal, miniaturization, transformation, and binning.
‫In the next prompt, I will write What is Game of Thrones?
‫Let's run this code.
‫And here you can see that the Game of Thrones is a popular fantasy television series based on the book
‫series A Song of Ice and Fire by George Martin.
‫So you can see that with the integration, we can use the power of ChatGPT within our Jupyter notebook.
‫So that's all in this video.
‫See you in the next one.
‫Thank you.