I’m trying to setup the chatGPT API, however I’m getting the following error: InvalidRequestError : Invalid URL (POST /v1/chat/completions/engines/gpt-3.5-turbo/chat/completions
I’m using the following code:
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(
engine="gpt-3.5-turbo",
messages=messages)
Thanks for the reply, but how do I use the link you provided? Should I change openai.api_base? I’m fairly new to this. To add, the error now is: InvalidRequestError : Invalid URL (POST /v1/engines/gpt-3.5-turbo/chat/completions), which is slightly different from before
PS. I checked on the openai github and 0.27.0 is the latest version
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.