Advertisement
A_GUES

ChatGPT

Jul 8th, 2023
1,253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import openai
  2.  
  3. # Set up your OpenAI API credentials
  4. openai.api_key = 'YOUR_API_KEY'
  5.  
  6. # Define the prompt for the model
  7. prompt = "Once upon a time"
  8.  
  9. # Generate text using the model
  10. response = openai.Completion.create(
  11.   engine="text-davinci-003",
  12.   prompt=prompt,
  13.   max_tokens=100
  14. )
  15.  
  16. # Print the generated text
  17. print(response.choices[0].text.strip())
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement