Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import openai
- # Set up your OpenAI API credentials
- openai.api_key = 'YOUR_API_KEY'
- # Define the prompt for the model
- prompt = "Once upon a time"
- # Generate text using the model
- response = openai.Completion.create(
- engine="text-davinci-003",
- prompt=prompt,
- max_tokens=100
- )
- # Print the generated text
- print(response.choices[0].text.strip())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement