Use GPT-3 API in Python to create awesome projects.
20 January, 2023
1
1
0
Contributors
Hello, Greeetings!
Before we get into our main topic, lets introduce CHATGPT to beginners.
What is Chatgpt ?
It is an AI- powered chatbot launched by OpenAI.
It can give answers to your toughest doubts and even write the code and much more.
Anyone can access it from chat.openai.com
How to use it in Python?
Step 1: Install the OpenAI API client library for Python
Step 2: Go to beta.openai.com/account/api-keys
to create your secret API key. It is required to create project.
Step 3 : CHATGPT has set of models that can understand and generate natural language. Choose any one you want to work with.
Step 4: Put your API Key and prompt (input) & create a function and
hurrah, we did it.
Here is a basic example, you can play with the code as much as you want.
Important terms used in that code:
Temperature : Higher values means the model will take more risks.
Try 0.9 for more creative applications, and 0 for ones with a well-defined answer.
Stop: Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
You can learn more functions and terms from their official documentation : https://beta.openai.com/docs/api-reference
That's all for this show. Thanks.