Azure OpenAI API error with gpt-35-turbo deployment

Ignac Szigeti 5 Reputation points
2023-08-04T09:42:57.37+00:00

This is the code that I am deploying and I receive the following error message.

User's image

I get this error message: InvalidRequestError: The completion operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993

However, the deployments are created properly and we have a correct subscriptions. Is anyone else facing the same problem? Would you have any suggestion as to how to troubleshoot this? thank you!

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 18,716 Reputation points Moderator
    2023-08-04T21:55:50.3266667+00:00

    Hello @Ignac Szigeti , Thanks for using Microsoft Q&A Platform.

    This is a known behavior. Version 0613 and all future versions of gpt-35-turbo will only be made available in the /chat/completions API. As ChatML could change in future versions of the model which would then require users to update their prompts. https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/chatgpt?pivots=programming-language-chat-ml#working-with-the-chat-models

    Please visit this to know more: How to work with the GPT-35-Turbo and GPT-4 models - Azure OpenAI Service | Microsoft Learn

    You can use Chat completion API. As, the Chat Completion API is a new dedicated API for interacting with the GPT-35-Turbo and GPT-4 models. So, it's better to use this API for accessing these models. https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/chatgpt?pivots=programming-language-chat-completions

    Here is the code for your reference:

    import os
    import openai
    openai.api_type = "azure"
    openai.api_version = "2023-05-15" 
    openai.api_base = os.getenv("OPENAI_API_BASE")  # Your Azure OpenAI resource's endpoint value.
    openai.api_key = os.getenv("OPENAI_API_KEY")
    
    response = openai.ChatCompletion.create(
        engine="gpt-35-turbo", # The deployment name you chose when you deployed the GPT-35-Turbo or GPT-4 model.
        messages=[
            {"role": "system", "content": "Assistant is a large language model trained by OpenAI."},
            {"role": "user", "content": "Who were the founders of Microsoft?"}
        ]
    )
    
    print(response)
    
    print(response['choices'][0]['message']['content'])
    

    Try this and let us know if you face issues.

    I hope this helps.

    Regards,
    Vasavi

    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.