assert openai.__version__ == '0.27.10' # latest as of this question
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo", # engine too does not work (and docs has model)
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
print(completion.choices[0].message)
InvalidRequestError: Must provide an 'engine' or 'deployment_id' parameter to create a
ok, let me give you my entire demo code an see if this runs for you, you can then utilise that as a jumping off point, note that I make use of environmental variable set with the export command, if you wish the API key to be stored in your enviroment across reboots and session you can use echo 'export OPENAI_API_KEY=your_api_key' >> ~/.bashrc
Protip 2: only specifying the latest API versions will get you function calling, the latest is 2023-08-01-preview
as of 2023-07-01-preview, only GPT-4 could use functions.
You can also explore 2023-08-01-preview, and see a extensionsChatCompletionsRequest with things like "dataSources": alongside messages, and the citations output format demonstrated in Bing AI chat.