Closed uchimanajet7 closed 4 months ago
Also seeing this behavior.
Confirming that it appears to be tied to the API version: This works:
import openai
import os
from dotenv import load_dotenv
load_dotenv()
openai.api_version = '2023-03-15-preview'
openai.api_base = os.environ.get('AZURE_OPENAI_ENDPOINT') # Please add your endpoint here
openai.api_key = os.environ.get('AZURE_OPENAI_API_KEY') # Please add your api key here
openai.api_type = 'azure'
engine = "gpt-35-turbo"
openai.Deployment.list()
But this does not
import os
from dotenv import load_dotenv
load_dotenv()
openai.api_version = '2023-05-15'
openai.api_base = os.environ.get('AZURE_OPENAI_ENDPOINT') # Please add your endpoint here
openai.api_key = os.environ.get('AZURE_OPENAI_API_KEY') # Please add your api key here
openai.api_type = 'azure'
engine = "gpt-35-turbo"
openai.Deployment.list()
Moving forward (Azure API versions 2023-05-15 and newer), the deployments APIs are deprecated in the openai library. They will remain accessible in earlier versions (like 2023-03-15-preview). For all code managing deployments, it is recommended to use the azure-mgmt-cognitiveservices client library. This library has additional options for working with deployments, like setting a deployment name or specific model version, and is the place where new features for deployments will be added.
Here are some samples to assist in migrating the code:
Create a deployment Retrieve a deployment List deployments Delete a deployment
Describe the bug
Until now, I had been referring to the following post to retrieve the Azure deployment name.
When I set the
openai.api_version
to the latest2023-05-15
, it stopped functioning properly. Since there are no other changes, I believe it's due to the version. Is there any way to address this issue?To Reproduce
Here is the code that works without any issues:
This returns a response where id is your deployment name and model is the model name.
When executing the code by simply switching to
openai.api_version = "2023-05-15"
, the following stack trace is returned:Code snippets
No response
OS
Google Colab
Python version
3.10.11
Library version
openai-python v0.27.7