| 123456789101112131415161718192021222324252627 |
- import openai
- import os
- # Set API key
- openai.api_key = os.getenv("OPENAI_API_KEY")
- # Define the prompt you want to send to ChatGPT
- user_input = input("Please enter some text: ")
- print("You entered: " + user_input)
- prompt = user_input
- print("Prompt to be sent to ChatGPT: " + prompt)
- # Send the prompt to ChatGPT and receive a response
- # response = openai.Completion.create(
- # engine="davinci",
- # prompt=prompt,
- # max_tokens=60,
- # n=1,
- # stop=None,
- # temperature=0.7,
- # )
- # Print the response
- # print(response.choices[0].text.strip())
|