zhen tan Greetings & Welcome to Microsoft Q&A forum!
result:openai.BadRequestError: Error code: 400 - {'error': {'code': 'OperationNotSupported', 'message': 'The completion operation does not work with the specified model, gpt-4. Please choose different model and try again.
You are getting this error as Completion operation is not supported by gpt-4 models. These models only support Chat Completions API. The Chat Completion API is also the only way to access the GPT-4 models.
To learn more about how to interact with GPT-4 and the Chat Completions API check out our in-depth how-to.
Additionally, Models page of Azure AI Studio displays the features supported by the Model as shown in the below screenshot
I hope this helps. Do let me know if you have any further queries.
If the response helped, please do click Accept Answer
and Yes
for was this answer helpful.
Doing so would help other community members with similar issue identify the solution. I highly appreciate your contribution to the community.