Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Model API doesn't retrieve Azure OpenAI deployments #920

Unanswered
mspronesti asked this question in Q&A
Discussion options

OpenAI version: 1.3.7
Python version: 3.10

I'm trying to access the deployments associated with a specific Azure OpenAI subscription as follows

from openai import AzureOpenAI
client = AzureOpenAI(
 api_version="2023-08-01-preview",
 azure_endpoint="https://xxx.openai.azure.com/",
 api_key="xxx",
)
models = client.models.list()
print(models)
for model in models:
 print(model.id)

However this returns a list of all the models available, not those I deployed (with their specific deployment name).

ada
babbage
curie
davinci
gpt-35-turbo-0301
gpt-35-turbo-0613
gpt-35-turbo-1106
gpt-4-1106-Preview
gpt-35-turbo-instruct-0914
gpt-35-turbo-16k-0613
gpt-4-0314
gpt-4-0613
gpt-4-32k-0314
gpt-4-32k-0613
text-davinci-003
text-similarity-ada-001
text-similarity-babbage-001
text-similarity-curie-001
text-similarity-davinci-001
text-search-ada-doc-001
text-search-ada-query-001
text-search-babbage-doc-001
text-search-babbage-query-001
text-search-curie-doc-001
text-search-curie-query-001
text-search-davinci-doc-001
text-search-davinci-query-001
code-search-ada-code-001
code-search-ada-text-001
code-search-babbage-code-001
code-search-babbage-text-001
text-embedding-ada-002
text-embedding-ada-002-2
gpt-35-turbo
gpt-35-turbo-instruct
gpt-35-turbo-16k
gpt-4
gpt-4-32k
text-embedding-ada-002

How can I achieve the desired outcome? Thanks in advance :)

You must be logged in to vote

Replies: 8 comments 8 replies

Comment options

You must be logged in to vote
2 replies
Comment options

Comment options

Build AI-Powered dApps with Auto SDK | Win USDC Prizes! 💰
Message:

Calling all developers! The Auto Horizon Developer Challenge is live—your chance to build groundbreaking decentralized applications (super dApps) or AI agents using the powerful Autonomys Auto SDK.

🏆 Prizes:

🥇 1,000ドル USDC
🥈 500ドル USDC
🥉 300ドル USDC
🛠 SDK Highlights: Decentralized storage, consensus tools, and more!

📅 Timeline: Submit your project by Jan 31, 2025.

Resources:

SDK Docs
Join Discord
Let’s build the future of decentralized AI together! 🚀

Comment options

Any updates on this?

You must be logged in to vote
0 replies
Comment options

Sorry for delay, was just making sure I had the right answer. I believe you need to use this SDK for listing deployments:
https://pypi.org/project/azure-mgmt-cognitiveservices/

You'd initialize with this:
https://learn.microsoft.com/en-us/python/api/azure-mgmt-cognitiveservices/azure.mgmt.cognitiveservices.cognitiveservicesmanagementclient?view=azure-python

And then looks like the method to list deployments:
https://learn.microsoft.com/en-us/python/api/azure-mgmt-cognitiveservices/azure.mgmt.cognitiveservices.operations.deploymentsoperations?view=azure-python#azure-mgmt-cognitiveservices-operations-deploymentsoperations-list

It might require more filtering to get OpenAI specific deployments. I haven't used this particular API myself.

Background: For Azure resources, we generally distinguish between the "control plane" and the "data plane", where the control plane does stuff like create new Azure resources and the data plane actually uses those resources. In this case, the control plane is taken care of by azure-mgmt-cognitiveservices and the data plane by the openai package.

I've passed feedback onto the team that this is not a clear developer experience.

You must be logged in to vote
3 replies
Comment options

Deployments APIs were deprecated in the v0.X version of the openai library and so they were not added for v1.X. For all code managing deployments, please 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 for interacting with deployments:

Create a deployment
Retrieve a deployment
List deployments
Delete a deployment

Comment options

Eventhough it offers a "workaround", it is not really ideal having to provide some Tenant ID and client secrets...

It would be better if we could simply retrieve this information only with the azure openai api key and the resource name.....

Comment options

It makes sense to separate the control plane from the data plane, but I don't understand why the list of base models (and not model deployments) is returned in the data plane, as the base models are essentially useless to the data plane. For example, the only valid values for the model field in the data plane API are deployment names, not base models. So the behavior of models.list in AzureOpenAI is not symmetrical with OpenAI.

Comment options

@rattrayalex / @mspronesti Could you please let us know what you plan to do with the models (/deployments) returned once listed using this SDK? As in what is your overarching use case/job to be done to list this? Fine tuning or something else?

You must be logged in to vote
3 replies
Comment options

Hi there, the easiest thing that comes to mind is the validation of the provided deployment name (e.g. when writing a class on top of AzureOpenAI). I'm not sure I understand why the model API does not have a symmetric behavior as it used to have before ('til version 2022年05月12日, I think). It would be nice to have it back unless I'm missing any critical drawbacks :)

Comment options

I'd also like it to make things easy for end-users who didnt specify a deployment to begin with. then i can offer them a list.

Comment options

Isn't it the case that everywhere the model parameter is required in the SDK it actually requires a model deployment? Whether it's completions or fine-tuning. This makes it frustrating that models#list returns the base models, which AFAIK are never useful in this SDK (and only useful to the azure-mgmt-cognitiveservices library).

Comment options

OpenAI version: 1.3.7 Python version: 3.10

I'm trying to access the deployments associated with a specific Azure OpenAI subscription as follows

from openai import AzureOpenAI
client = AzureOpenAI(
 api_version="2023-08-01-preview",
 azure_endpoint="https://xxx.openai.azure.com/",
 api_key="xxx",
)
models = client.models.list()
print(models)
for model in models:
 print(model.id)

However this returns a list of all the models available, not those I deployed (with their specific deployment name).

ada
babbage
curie
davinci
gpt-35-turbo-0301
gpt-35-turbo-0613
gpt-35-turbo-1106
gpt-4-1106-Preview
gpt-35-turbo-instruct-0914
gpt-35-turbo-16k-0613
gpt-4-0314
gpt-4-0613
gpt-4-32k-0314
gpt-4-32k-0613
text-davinci-003
text-similarity-ada-001
text-similarity-babbage-001
text-similarity-curie-001
text-similarity-davinci-001
text-search-ada-doc-001
text-search-ada-query-001
text-search-babbage-doc-001
text-search-babbage-query-001
text-search-curie-doc-001
text-search-curie-query-001
text-search-davinci-doc-001
text-search-davinci-query-001
code-search-ada-code-001
code-search-ada-text-001
code-search-babbage-code-001
code-search-babbage-text-001
text-embedding-ada-002
text-embedding-ada-002-2
gpt-35-turbo
gpt-35-turbo-instruct
gpt-35-turbo-16k
gpt-4
gpt-4-32k
text-embedding-ada-002

How can I achieve the desired outcome? Thanks in advance :)

You must be logged in to vote
0 replies
Comment options

Build AI-Powered dApps with Auto SDK | Win USDC Prizes! 💰
Message:

Calling all developers! The Auto Horizon Developer Challenge is live—your chance to build groundbreaking decentralized applications (super dApps) or AI agents using the powerful Autonomys Auto SDK.

🏆 Prizes:

🥇 1,000ドル USDC
🥈 500ドル USDC
🥉 300ドル USDC
🛠 SDK Highlights: Decentralized storage, consensus tools, and more!

📅 Timeline: Submit your project by Jan 31, 2025.

Resources:

SDK Docs
Join Discord
Let’s build the future of decentralized AI together! 🚀

You must be logged in to vote
0 replies
Comment options

Autonomys' Auto Horizon Developer Challenge

Calling all developers and AI agent builders!
Join the Autonomys' Auto Horizon Developer Challenge and showcase your skills using the powerful Auto SDK!

What's the challenge about?
Create, build, and develop innovative decentralized applications using the early version of Auto SDK. The possibilities are endless:

  • Build a market intelligence oracle
  • Develop a prediction tool
  • Create something entirely new!

Why participate?

  • Earn rewards
  • Build with ease using Auto SDK
  • Power your development on Autonomys' network

Challenge requirements:

  1. Create a decentralized application using Auto SDK
  2. No limits to what you can build
  3. Your project must be open-source
  4. Post your submission in the #Developer-chat channel

Prizes:

1st position: 1,000ドル
2nd position: 500ドル
3rd position: 300ドル

Don't miss out!
You have until January 31st, 2025, to participate. Follow the link for more information and to register:

https://forum.autonomys.xyz/t/auto-horizon-developer-challenge/4645

You must be logged in to vote
0 replies
Comment options

It is really baffling that someone thought it's a good user experience to prevent listing the available deployments for an AI resource?!

We have a simple UI that lets users input their Service Endpoint and the Api Key (or better yet, an IT person put those information in for them). Now all that is left for the actual user to be able to submit a query to the LLM is to select the actual model they want to use (aka a deployed model in Azure world). If my developers could, with the two information above, get the list of deployments, they could present the user with a nice dropdown, and then the user can select one of their available models. Easy! Good UX.

But no, not with Azure! Here, either the user needs to know what deployment IDs they have available and paste them in manually, or find much more credentials and information for the overarching Azure account itself so my developers are able to query some resource endpoint to get the deployments.

TL;DR:

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /