Setting up the ChatGPT API

As per PaulBellow’s suggestion, try changing the key engine to model.

messages = [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Who won the world series in 2020?"},
        {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
        {"role": "user", "content": "Where was it played?"}
        ]

response = openai.ChatCompletion.create(
            model="gpt-3.5-turbo",
            messages=messages)

Slightly confusing interface change, if you ask me.

2 Likes