#No responses
3 messages · Page 1 of 1 (latest)
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(completion.choices[0].message)```
Maybe this sample will help you. Plus you most likely don't want to be using DaVinci unless you has a specific reason.
You can replace os.getenv.... with your actual api key (as a string) if you don't have it set up as an environment variable.