preamble
Recently chatGPT is quite hot, also tried to play a little, really quite interesting. Here is a record of how to use chatGPT in Python.
The implementation of this post is 100% based on chatGPT, I'm a mover and shaker no doubt!!!!
This movie article is relatively simple.
point of knowledge (math.)
pip install openai
(coll.) pretty soonchatGPT
The performance:
Write a piece of code to send a web request using python
python how to md5
There are also signs of tics:
Xiao Ming's mom is 20 years old, how old will Xiao Ming's mom be in 20 years?
I can't finish a cake cut into 8 pieces, but it's just right to cut it into 4? Why is that?
realization
Q: How to use chatGPT in python?
Answer:
The answer was very clear, telling us to install firstopenai
module, and then replace the key for your account application in the code.
coding
In this code, we just need to fill in the key in thePython
hit the nail on the headchatGPT
Up.
import openai # Set your API key openai.api_key = "YOUR_API_KEY" # Use the GPT-3 model completion = ( engine="text-davinci-002", prompt="Once upon a time, in a land far, far away, there was a princess who...", max_tokens=1024, temperature=0.5 ) # Print the generated text print([0].text)
Code running effect
something be taken up later in speech or writing
To this point this article on the hand to teach you to use ChatGPT in Python article is introduced to this, more related to the use of Python ChatGPT content, please search for my previous articles or continue to browse the following related articles I hope you will support me in the future more!